ViewStateMode 枚举

定义

指定是否将为控件启用视图状态。Specifies whether view state will be enabled for a control.

public enum class ViewStateMode
public enum ViewStateMode
type ViewStateMode = 
Public Enum ViewStateMode
继承
ViewStateMode

字段

Disabled 2

禁用此控件的视图状态,即使父控件已启用了视图状态也是如此。Disable view state for this control even if the parent control has view state enabled.

Enabled 1

启用此控件的视图状态,即使父控件已禁用了视图状态也是如此。Enable view state for this control even if the parent control has view state disabled.

Inherit 0

从父级 Control 继承 ViewStateMode 的值。Inherit the value of ViewStateMode from the parent Control.

注解

您可以使用Control.ViewStateMode属性为单个控件启用视图状态, 即使该页已禁用。You can use the Control.ViewStateMode property to enable view state for an individual control even if it is disabled for the page.

若要关闭页面的视图状态, 并为该页上的特定控件打开视图状态, 请将页面EnableViewState和控件的属性设置为true, 将页面的ViewStateMode属性设置为 "已禁用", 并设置ViewStateMode控件的属性。为启用。To turn off view state for a page and turn it on 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.

ViewStateMode true当属性设置为时, 页面或控件的属性才有效果。 EnableViewStateThe ViewStateMode property of a page or a control has an effect only if the EnableViewState property is set to true. 如果将false属性设置为, 则即使将属性设置为 "启用" ViewStateMode , 也会关闭视图状态。 EnableViewStateIf the EnableViewState property is set to false, view state will be turned off even if the ViewStateMode property is set to Enabled.

适用于

另请参阅