C#, .net
Original Code:
<asp:TemplateField ItemStyle-Width="20px" ItemStyle-HorizontalAlign="Center">
<itemtemplate>
<asp:Label ID="lblDependency" Runat="server"></asp:Label>
</itemtemplate>
</asp:TemplateField>
I'd like to do something like this:
BoundField bf = new BoundField();
bf.DataField = "b";
grvList.Columns.Add(bf);
but instead of boundfield, using templatefield.
If you would like to know why am I doing something like this, it has to do with: this
http://msdn.microsoft.com/en-us/library/Aa289501 Covers this I believe (scroll down to the bottom for a DataGrid complete example). Basically you cannot have it parse ASP tags directly, you have to create a custom class that implements them programmatically, then instantiate that class.