Home > DeveloperSection > Interviews > Explain how to access ViewState value of this page in the next page.

Posted on    October-11-2011 2:16 AM

 ASP.NET MVC ASP.NET MVC 
Ratings:
 1 Answer(s)
  4664  View(s)
Rate this:

Chris Anderson
Chris Anderson

Total Post:197

Points:985
Posted on    October-11-2011 12:00 AM

PreviousPage property is set to the page property of the nest page to access the viewstate value of the page in the next page. Page poster = this.PreviousPage;
Once that is done, a control can be found from the previous page and its state can be read.
Label posterLabel = poster.findControl("myLabel");
string lbl = posterLabel.Text;

Don't want to miss updates? Please click the below button!

Follow MindStick