The view status is a repository on the ASP. NET page, which stores the values that need to be retained during the sending-back. View status is usually used for page variables that must be retained, rather than for user or session data. For example, you can store view status information. When you send a page to the server next time, the page will be accessed during the page loading activity.
View status data is stored in one or more hidden fields in base64 encoded string format. You can use the viewstate attribute of the page (which exposes a dictionary object) to access the view State information. View State data is stored as strings, so only serialized objects can be stored.
Because the view status is sent as a hidden field, you can change the view status until the prerendercomplete event occurs. Once the page is displayed in the browser, you cannot save changes to the view status.
If you view the page output source, you can see information in the hidden view Status field, which may cause security issues. To alleviate this problem, you canViewstateencryptionmodeSet the property to"AlwaysTo encrypt the view status.
The followingCodeThe example shows how to add an arraylist to the view State.
Viewstate. Add ("arraylistinviewstate", pagearraylist );
Value of the view status:
If (! Viewstate ["sortfield"] = NULL) object o = viewstate ["sortfield"];
Modify the view status value:
Viewstate ["sortfield"] = newvalue;