Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,


How to store data in viewstate from gridview.Gridview is binding whith datareader.
Posted

1 solution

Hi,

First, What you have to store in View State. You can store in Viewstate any type of data in following way.

ViewState["Data"] = data;

if you have any confusion then you can ask me.

You can follow below link:

Beginner's Guide To View State [^]
 
Share this answer
 
Comments
Amit Vasi 15-Jul-14 1:35am    
but my gridview is binding with datareader...

IDataReader idr = cmd.ExecuteReader();
GridView1.DataSource = idr;
GridView1.DataBind();


how it is possible
Sarvesh Kumar Gupta 15-Jul-14 1:46am    
Then add datareader to View State, and when you have to work on that put in datareader again from ViewState using casting.

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