Control.ClearChildControlState 方法


删除服务器控件的子控件的控件状态信息。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. 在调用 SaveControlState 方法之前调用 ClearChildControlState 方法为空子控件将减小必须存储或传输的控件状态信息的大小。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.