I am created dynamically template columns to a gridview and assign datatable as a datasource.Its working fine.Whenever i am postback the form the data in gridview is disappear.Why the dynamic template fields are maintaing the viewstate. Any idea ?
Dynamic template columns to a gridview
Hi to All
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Atul KumarRank #1,527 · 1K reputationPosted Jul 26, 2012, 2:52 AM EDT
if(IsPostback)
If postback occurs then do not bind your datasource again to gridview.
This is happening because on postback, your gridview is binding again.
Rambabu CH77 reputationPosted Jul 26, 2012, 4:44 AM EDT