Accessing View State of one page on Next ASP.Net Page

by Rick| Views: 1244

Is it possible to get first ASP.Net web page ViewState to second ASP.NET web Page?

How can we post ViewState of one to page to another page in ASP.NET?

Answers (1)
 
Tech Guru Said..

View state is page specific; it contains information about controls embedded on the particular page. ASP.NET 2.0 resolves this by embedding a hidden input field name,
__POSTBACK . This field is embedded only when there is an IButtonControl on the page and its PostBackUrl property is set to a non-null value. This field contains the view state information of the poster page.

To access the view state of the poster page, you can use the new PreviousPage property of the page:

Page poster = this.PreviousPage;

Then you can find any control from the previous page and read its state:

Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;

Thus you can get the values of control (ViewState) of previous page. To Learn How to Post values from Previous page to Next page Please Browse following link

Cross Page Posting in ASP.NET Web Pages



Register or Login to Post Your Opinion/Answer