PlaceHolder 容器占位,不输入当容器代码,并让其换行.
前台:
<asp:PlaceHolder ID="PHD_" runat="server"></asp:PlaceHolder>
<asp:Repeater ID="rptTest" runat="server">
<HeaderTemplate>
<table style="width: 100%">
</HeaderTemplate>
<ItemTemplate>
<asp:PlaceHolder ID="PlaceHolder1" runat="server" Visible='<%# (Container.ItemIndex + 1) % 7 ==1 %>'><%--出现7列时换行--%>
<tr>
</asp:PlaceHolder>
<td style="width: 14%; text-align: center">
<asp:HyperLink ID="linkUsername" runat="server"><%#Container.DataItem %></asp:HyperLink>//输出值
</td>
<asp:PlaceHolder ID="PlaceHolder2" runat="server" Visible='<%# (Container.ItemIndex + 1) % 7==0 %>'>
</tr> </asp:PlaceHolder>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
后台:邦定略;
PHD_.Contros.add(定义用户控件或HTML代码);