Search code examples
c#asp.netgridviewdatatabletemplatefield

How to make a template field(textbox) as a part of the datatable


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.


Solution

  • 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

    1. http://www.highoncoding.com/Articles/29_Creating_Datagrid_columns_programmatically.aspx
    2. http://www.codeproject.com/KB/aspnet/create_template_columns.aspx?df=100&forumid=281019&exp=0&select=1726624