Control.IsViewStateEnabled Control.IsViewStateEnabled Control.IsViewStateEnabled Control.IsViewStateEnabled Property


取得值,指出這個控制項是否已啟用檢視狀態。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屬性(property) IsViewStateEnabled和屬性(property)可能會有不同的。It is possible for the EnableViewState property and the IsViewStateEnabled property to be different. 例如,如果包含控制項Page的已停用 view 狀態,則EnableViewStateIsViewStateEnabled屬性為falsetrue ,屬性可以是。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.