Control.ClearChildViewState Method

Deletes the view-state information for all the server control's child controls.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

protected void ClearChildViewState ()
protected void ClearChildViewState ()
protected function ClearChildViewState ()
Not applicable.

This method is commonly used when you override the DataBind method when developing templated data-bound server controls. If you do not call this method, child control view–state information can be written to a parent server control, only to be overridden when the data is bound.

When recreating child controls of a Control, use the ClearChildViewState method to clear child view state so that it does not get applied to the new controls inadvertently.

For more information about using this method, see How to: Create Templated ASP.NET User Controls.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions