Reputation: 5941
Hi i want to force DataList to render rows as columns, where first column is rows description. I can not use repeater cos i want to edit and update data
. I started with that but it works compleatly wrong:
<asp:DataList ID="DataList1" runat="server" DataKeyField="Name" >
<HeaderTemplate>
<table style="border:1">
<tr><td>Name</td>
<tr><td>FirstName</td>
</HeaderTemplate>
<ItemTemplate>
<td><asp:TextBox runat="server" Text='<%#Eval("Name")%>' ID="Code" ReadOnly="true" /> </td>
<td><asp:TextBox runat="server" Text='<%#Eval("FirstName")%>' ID="TextBox1" ReadOnly="true" /> </td>
</ItemTemplate>
<FooterTemplate>
</tr>
</tr>
</table>
</FooterTemplate>
</asp:DataList>
I could use only this
<asp:DataList ID="DataList1" runat="server" DataKeyField="Name" RepeatDirection="Vertical" >
<ItemTemplate>
<asp:TextBox runat="server" Text='<%#Eval("Name")%>' ID="Code" ReadOnly="true" />
<asp:TextBox runat="server" Text='<%#Eval("FirstName")%>' ID="TextBox1" ReadOnly="true" />
and then i am missing only firs column with labels, how could i add them?
Upvotes: 2
Views: 1705
Reputation: 10243
Don't use a table. Let each item be a list item and put your controls in there. You can then float each list item left.
Upvotes: 2