I got a GridView in ASP.Net in which a user control is placed:
<asp:GridView ID="GVWunitcollection"
CssClass="gridview"
runat="server"
ShowHeader="false"
ShowFooter="false"
AutoGenerateColumns="False">
<HeaderStyle CssClass="headerstyle" />
<RowStyle CssClass="rowstyle row" />
<FooterStyle CssClass="rowstyle row" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<uc:Unit ID="UNTcol" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
I bind the GridView to a List<T>
filled with custom 'Unit' Classes. Each Unit consists of several properties to fill the usercontrol. (The user control holds a table, and some labels and textboxes).
How can I achieve this? Is there a simple way to bind each usercontrol to the appropriate Unit?
By the way, this is my way to mimic a "dynamic" behavior of multiple usercontrols on a page. If there's a more simple way, I would like to know how!
thank you!