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.

适用于

另请参阅