Reputation: 34158
I have asp repeater which looks like this
<asp:Repeater runat="server" ID="Repeater1">
<HeaderTemplate>
<table border="1">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td>
<%# Eval("Username")%>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
How can I make table layout like this?
Upvotes: 1
Views: 2133
Reputation: 1386
Try Listview
<asp:ListView ID="ContactsListView"
DataSourceID="ContactsDataSource"
GroupItemCount="2"
runat="server">
<ItemTemplate>
<%# Eval("Username")%>
</ItemTemplate>
</asp:ListView>
Upvotes: 1
Reputation: 3401
A Repeater
is a for-loop like structure for rendering markup.
You can accomplish what you're trying to do by using a nested repeater: Outside repeater for <tr>
's and wrap your <td>
's in another repeater.
You can also accomplish this by using asp:DataList
control, which is a more elegant solution to what you're trying to do.
Upvotes: 1