Control.ClearChildControlState Control.ClearChildControlState Control.ClearChildControlState Control.ClearChildControlState Method

定義

刪除伺服器控制項之子控制項的控制項狀態資訊。Deletes the control-state information for the server control's child controls.

protected:
 void ClearChildControlState();
protected void ClearChildControlState ();
member this.ClearChildControlState : unit -> unit
Protected Sub ClearChildControlState ()

備註

當撰寫新的子控制項時,會覆寫寫入父控制項控制項狀態的子控制項狀態資訊,例如在樣板化資料系結伺服器控制項中的資料系結子控制項時,會使用方法。ClearChildControlStateThe ClearChildControlState method is used when child control-state information written to the parent control's control state is overridden as new child controls are created, such as when data-binding child controls in a templated data-bound server control. 在呼叫方法之前呼叫ClearChildControlState方法來清空子控制項,可減少必須儲存或傳送的控制項狀態SaveControlState資訊大小。Calling the ClearChildControlState method to empty child controls before calling the SaveControlState method reduces the size of the control-state information that must be stored or transmitted.

重新建立Control物件的子控制項時,請ClearChildControlState使用方法來清除子控制項狀態,使其不會不慎套用至新的控制項。When recreating child controls of a Control object, use the ClearChildControlState method to clear child control state so that it does not get applied to the new controls inadvertently.

若要清除子控制項狀態和檢視狀態,請使用ClearChildState方法。To clear both the child control state and view state, use the ClearChildState method.

適用於

另請參閱