用DataList,设置RepeatColumns和RepeatDirection属性,RepeatColumns=n,行数要看你取的总数了,依题意,就一共取n*n条记录.
<asp:DataList ID="DataList_FrontPage" runat="server" RepeatColumns="3"
BorderWidth="1px" CellPadding="3" CellSpacing="1" Width="100%"
RepeatDirection="Horizontal" >
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<ItemStyle ForeColor="Black" Width="200px" />
<SelectedItemStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
<ItemTemplate>
......
</ItemTemplate>
</asp:DataList>
显示效果:
gridview?
gridview!