Ian Oldbury
2005-02-08 10:59:50 UTC
Hi,
Does anyone know how to add columns dynamically to a DataGrid.
i populate the grid using the .ItemDataBound
the current structure of my grids are as below....
<asp:templatecolumn>
<headertemplate>
<asp:label id="lblDisp" runat="server" text="" tooltip="" />
</headertemplate>
<itemtemplate>
<asp:label id="lblSales" runat="server" cssclass="GridTDText"></asp:label>
<br />
<asp:label id="lblProfit" runat="server"
cssclass="GridTDText"></asp:label>
<br />
<asp:label id="lblMargin" runat="server"
cssclass="GridTDText"></asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox id="txtSales" runat="server" cssclass="GridTextBox Small"
<asp:textbox id="txtProfit" runat="server" cssclass="GridTextBox
Small"></asp:textbox>
<br />
<asp:textbox id="txtMargin" runat="server" cssclass="GridTextBox
Small"></asp:textbox>
</edititemtemplate>
</asp:templatecolumn>
Does anyone know how to add columns dynamically to a DataGrid.
i populate the grid using the .ItemDataBound
the current structure of my grids are as below....
<asp:templatecolumn>
<headertemplate>
<asp:label id="lblDisp" runat="server" text="" tooltip="" />
</headertemplate>
<itemtemplate>
<asp:label id="lblSales" runat="server" cssclass="GridTDText"></asp:label>
<br />
<asp:label id="lblProfit" runat="server"
cssclass="GridTDText"></asp:label>
<br />
<asp:label id="lblMargin" runat="server"
cssclass="GridTDText"></asp:label>
</itemtemplate>
<edititemtemplate>
<asp:textbox id="txtSales" runat="server" cssclass="GridTextBox Small"
</asp:textbox>
<br /><asp:textbox id="txtProfit" runat="server" cssclass="GridTextBox
Small"></asp:textbox>
<br />
<asp:textbox id="txtMargin" runat="server" cssclass="GridTextBox
Small"></asp:textbox>
</edititemtemplate>
</asp:templatecolumn>