July 2015
Intermediate to advanced
1300 pages
87h 27m
English
Content preview from Visual Basic 2015 UnleashedBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
Start your free trial


The ViewState State
To provide support for the work that a page needs to do in its lifetime, ASP.NET provides a mechanism known as ViewState. It provides the infrastructure that serializes values for each control in the page. For example, when a page is rendered, a control has a particular value. When this value changes, and such change raises an event, ASP.NET makes a comparison between the ViewState and form variables so that it can update the control value. (The TextBox control with its TextChanged event is the most common example.) Such a mechanism is available behind the scenes, but you can also use the ViewState by yourself. The following is an example that makes an object available at page level:
ViewState("MyPageDataKey") ...