ControlCollection.Clear Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Removes all controls from the current server control's ControlCollection object.

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

abstract Clear : unit -> unit
override Clear : unit -> unit

Use this method to empty a custom control's ControlCollection when you override the Control.CreateChildControls and DataBind methods. Do this when you develop composite, templated controls or templated data-bound controls.

The following code example demonstrates overriding the Control.CreateChildControls method, and using the Clear method to delete all child controls previously in the ControlCollection object. In this case, you must do this so that outdated objects in your control's ControlCollection are not displayed inappropriately.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: