Repeater支持多行多列显示
Aspx代码
<asp:Repeater runat="server" id="repeater1" OnItemDataBound="Repeater1_ItemDataBound">
<HeaderTemplate>
<table width="100%" border=0 align="center"><tr>
</HeaderTemplate>
<ItemTemplate>
<td><%#Eval("数据")%></td>
</ItemTemplate>
<FooterTemplate>
</tr></table>
</FooterTemplate>
</asp:Repeater>
.Cs代码
protected int i=1;
protected void Repeater1_ItemDataBound(object src,RepeaterItemEventArgs e)
...{
if(i%3==0)...{
e.Item.Controls.Add(new LiteralControl("</tr><tr>"));
}
i++;
}
需要注意的是 i是全局变量