Repeater 换行显示

1、后台写一方法

 

 public string GetBlankRow(RepeaterItem item)
 {
        if ((item.ItemIndex + 1) % 3 == 0)
        {
            return "<tr><td colspan='3'><hr><td></tr>";
        }
        else return " ";
  }

 

 

 

2、页面调用方法

 

 <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate>
                    <table>
                        <tr>
                            <td>
                                <%#Eval("DeptName") %>
                            </td>
                            <td>
                                <%#Eval("CreateDate") %>
                            </td>
                            <td>
                                <%#Eval("FullID") %>
                            </td>
                        </tr>
                        <%#GetBlankRow(Container)%>
                    </table>
                </ItemTemplate>
   </asp:Repeater>

你可能感兴趣的:(String,server,table,asp)