संपादित करें

इसके माध्यम से साझा किया गया


Control.ViewStateMode Property

Definition

Gets or sets the view-state mode of this control.

public:
 virtual property System::Web::UI::ViewStateMode ViewStateMode { System::Web::UI::ViewStateMode get(); void set(System::Web::UI::ViewStateMode value); };
[System.Web.UI.Themeable(false)]
public virtual System.Web.UI.ViewStateMode ViewStateMode { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.ViewStateMode : System.Web.UI.ViewStateMode with get, set
Public Overridable Property ViewStateMode As ViewStateMode

Property Value

The view-state mode of this control.

Attributes

Exceptions

An attempt was made to set this property to a value that is not in the ViewStateMode enumeration.

Remarks

You can use the ViewStateMode property to enable view state for an individual control even if view state is disabled for the page. For more information about view state and control state, see the EnableViewState property.

To disable view state for a page and to enable it for a specific control on the page, set the EnableViewState property of the page and the control to true, set the ViewStateMode property of the page to Disabled, and set the ViewStateMode property of the control to Enabled.

The default value of the ViewStateMode property for a page is Enabled. The default value of the ViewStateMode property for a Web server control in a page is Inherit. As a result, if you do not set this property at either the page or the control level, the value of the EnableViewState property determines view-state behavior.

The ViewStateMode property of a page or a control has an effect only if the EnableViewState property is set to true. If the EnableViewState property is set to false, view state will be turned off even if the ViewStateMode property is set to Enabled.

Applies to

See also