Control.IsViewStateEnabled 属性

定义

获取一个值,该值指示是否为该控件启用了视图状态。Gets a value indicating whether view state is enabled for this control.

protected public:
 property bool IsViewStateEnabled { bool get(); };
protected internal bool IsViewStateEnabled { get; }
member this.IsViewStateEnabled : bool
Protected Friend ReadOnly Property IsViewStateEnabled As Boolean

属性值

如果为控件启用了视图状态,则为 true;否则为 falsetrue if view state is enabled for the control; otherwise, false.

注解

可以在页、容器或控件级别启用视图状态。View state can be enabled at the page, container, or control level. 当在页或容器级别禁用视图状态时,将为该页或容器包含的所有控件禁用视图状态。When view state is disabled at the page or container level, view state is disabled for all controls contained by the page or container. IsViewStateEnabled 属性指示是由页、容器还是控件启用视图状态。The IsViewStateEnabled property indicates whether view state is enabled by pages, containers, or controls.

EnableViewState 属性和 IsViewStateEnabled 属性可能不同。It is possible for the EnableViewState property and the IsViewStateEnabled property to be different. 例如,如果包含控件的 Page 禁用了视图状态,则在 IsViewStateEnabled 属性 false时,可以 true EnableViewState 属性。For example, if the Page containing the control has view state disabled, the EnableViewState property can be true while the IsViewStateEnabled property is false.

继承者说明

页面开发人员将设置 EnableViewState 属性和 ViewStateMode 属性,以指示它们是否与控件一起使用视图状态。Page developers will set the EnableViewState property and the ViewStateMode property to indicate whether they are using view state with your control. 使用代码中的 IsViewStateEnabled 属性和 ViewStateMode 属性来确定是否为控件以及所有容器启用了视图状态。Use the IsViewStateEnabled property and the ViewStateMode property in your code to determine whether view state is enabled for your control and for all containers.

适用于

另请参阅