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屬性和IsViewStateEnabled不同的屬性。It is possible for the EnableViewState property and the IsViewStateEnabled property to be different. 例如,如果Page包含控制項的停用的檢視狀態EnableViewState屬性可以是true雖然IsViewStateEnabled屬性是falseFor 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.