Reputation: 11393
I have a GridView .
its data source is a data table
i create it pro-grammatically in .cs
to suit what i wanna to show. Now i wanna more column in this gridview as a template field containing a text box.(as a part of my data table). How to do this .Please if there is a sample or example this will be great.
Upvotes: 0
Views: 2138
Reputation: 1496
TemplateField bfield = new TemplateField();
bfield.HeaderTemplate = new GridViewTemplate(ListItemType.Header, col.ColumnName);
bfield.ItemTemplate = new GridViewTemplate(ListItemType.Item, col.ColumnName);
GrdView1.Columns.Add(bfield);
Upvotes: 1
Reputation: 63065
Following tutorial will help you. This is on ASP.net 2.0 but there will not be a much different on latest versions.
http://msdn.microsoft.com/en-us/library/bb288032.aspx
Added Few other resources based on new comment
Upvotes: 1
Reputation: 6030
<asp:TemplateField HeaderText="MyTextField">
<ItemTemplate>
<asp:TextBox runat="server" id="txtField">
</ItemTemplate>
</asp:TemplateField>
More details here: http://msdn.microsoft.com/en-us/library/aa479353.aspx
However, I think you're looking to do more than just this - but I can't be certain....
Upvotes: 0