Can we store gridview in viewstate asp.net

Posted by Allemahesh under ASP.NET on 7/16/2013 | Points: 10 | Views : 16765 | Status : [Member] [MVP] | Replies : 3
Can we store gridview in viewstate? If yes, then how to do it.




Responses

Posted by: Satyapriyanayak on: 7/16/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
http://www.codeproject.com/Articles/10088/DataGrid-s-ViewState-optimization

If this post helps you mark it as answer
Thanks

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Jitendrasoft09 on: 7/26/2013 [Member] [MVP] Starter | Points: 25

Up
0
Down
Hi Allemahesh,

Yes. You can store gridview into viewstate with following code-

DataTable table = GetTable();

GridView1.DataSource = table;
GridView1.DataBind();
ViewState["dataetwstate"] = GridView1.DataSource;

Refer below link for more information-
http://stackoverflow.com/questions/5503525/does-gridview-save-data-in-viewstate

Hope you have understood.

Jitendra Kumar
If my post helps you, plz mark as an answer.

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ssj_Kumar on: 7/27/2013 [Member] Starter | Points: 25

Up
0
Down
Yes, you can store any control data into viewstate

Regards,
Jayakumar Selvakani

Allemahesh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response