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


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

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


ClearChildControlState時建立新的子控制項時,例如在樣板化的資料繫結伺服器控制項中的資料繫結子控制項時,會覆寫子控制項狀態資訊寫入至父控制項的控制項狀態,方法使用。The 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.