Page.RequiresControlState(Control) Page.RequiresControlState(Control) Page.RequiresControlState(Control) Method

定義

判斷指定的 Control 物件是否已註冊要參與控制項狀態管理。Determines whether the specified Control object is registered to participate in control state management.

public:
 bool RequiresControlState(System::Web::UI::Control ^ control);
public bool RequiresControlState (System.Web.UI.Control control);
member this.RequiresControlState : System.Web.UI.Control -> bool

參數

control
Control Control Control

檢查其控制項狀態需求的 ControlThe Control to check for a control state requirement.

傳回

如果指定的 Control 要求控制項狀態,則為 true,否則為 falsetrue if the specified Control requires control state; otherwise, false

備註

控制項狀態是由 Web 服務器控制項必須運作的重要檢視狀態資料所組成的物件;它包含在來自一般檢視狀態的個別物件中。Control state is an object composed of critical view-state data that Web server controls need to function; it is contained in a separate object from normal view state.

使用控制項狀態的自訂控制項必須RegisterRequiresControlState先呼叫方法,才能儲存控制項狀態。Custom controls using control state must call the RegisterRequiresControlState method before saving control state. RequiresControlState使用方法,即可檢查已在頁面上註冊為需要控制項狀態的控制項。Use the RequiresControlState method to check for controls that are registered with the page as requiring control state.

適用於

另請參閱