Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have created a gridview with all the columns being dynamically created. i want to read some controls on postback. but none of the controls that are dynamically created are being recognised. i cant not use page init as the gridview is loaded based on some filters and the filters keep changing from time to time.

I would like to the the way in which i can refer to the dynamically created controls on postback of the page.

What I have tried:

this is the link which i followed for creating an dynamic gridview.
How can I create a TemplateField and ItemTemplate with C# code | The ASP.NET Forums[^]
Posted
Updated 11-Apr-16 22:15pm
Comments
F-ES Sitecore 12-Apr-16 4:55am    
Controls you create dynamically are not remembered on postback, so you'll have to create the controls again on postback to access their values.

1 solution

This is the tutorial about gridview


[^]
 
Share this answer
 
Comments
Pooja nag 12-Apr-16 5:27am    
I have followed the solution given in the link attached in my question. i am creating a column of checkbox which i want to access on a button click, unfortunately these checkbox fields created dynamically are not being found by the row.FindControl("ceheckBoxId").
Beginner Luck 12-Apr-16 5:34am    
http://stackoverflow.com/questions/5743099/looping-through-gridview-rows-and-checking-checkbox-control

(CheckBox)row.FindControl("ceheckBoxId").
Pooja nag 12-Apr-16 8:03am    
This is the same that i am using but, find control return a null. I checked in many places, it says for dynamically created control the control is not saved across post back.
Beginner Luck 13-Apr-16 5:01am    
you want create after post back?? can try use session
Pooja nag 13-Apr-16 5:26am    
i want to access a checkbox created before postback. this control is being lost on postback.

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