Click here to Skip to main content
15,947,389 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have created gridview with one row dynamically and created item template also dynamically and setting a value of row hardcore

when i trying to get the value of row so i didn't get anything

so how can i get the value of dynamic created item template of gridview

my Code for creating itemtemplate is

foreach (DataColumn col in dt.Columns)
                //Declare the bound field and allocate memory for the bound field.
                TemplateField bfield = new TemplateField();

                //Initalize the DataField value.
                bfield.HeaderTemplate = new GridViewTemplate(ListItemType.Header, col.ColumnName);

                //Initialize the HeaderText field value.
                bfield.ItemTemplate = new GridViewTemplate(ListItemType.Item, col.ColumnName);

                //Add the newly created bound field to the GridView.

Thanks in Advance
Updated 18-Jan-12 1:25am
Technoses 18-Jan-12 6:34am    
please write the code what you have done
[no name] 22-Feb-13 0:14am    
your problem solved or not. i am facing the same.

1 solution


When you setting any value (in your case hardcore value) add one Label control with it's ID and assign that value as Label Text. using that Lable identifier you can search for any control on your page.

Check Control.FindControl

So, Control.FindControl will return Lable control and from there you can find your value.

This may resolve your problem.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900