System.Web.UI Namespace Page Class
Sets or retrieves a value indicating whether the page maintains its view state, and the view state of any server controls it contains, when the current page request ends.
Inline |
<%@ Page EnableViewState = true | false ... > |
Script |
Page.EnableViewState [ = true | false ] |
This property accepts or returns only a boolean value: true if the page maintains its view state; otherwise false.
This property is read/write with a default value of true.
A page's view state, and the view state of any controls it contains, is the accumulation of all its property values. In order to preserve these values across HTTP requests, ASP.NET uses an instance of the StateBag class to store the property values. The values are then passed as a variable to a hidden field when subsequent requests are processed. For more information about view state, see Web Forms State Management.
NOTE: This property can also be set declaratively using the @ Page directive.
The following example shows the simplest way to retrieve and display the status of a page's view state.
<%= Page.EnableViewState %>
Show me
Page Members Web Forms Page Processing Stages Web Forms State Management @ Page