ControlCollection Class
Assembly: System.Web (in system.web.dll)
You can access any of the properties and methods of the ControlCollection class through the Control.Controls property. Since the Control class is the base class for all ASP.NET server controls, all server controls inherit this property.
For more information about collections, see Collections and Data Structures.
| Topic | Location |
|---|---|
| How to: Locate the Web Forms Controls on a Page by Walking the Controls Collection | Building ASP .NET Web Applications |
| How to: Create Instances of ASP.NET User Controls Programmatically | Building ASP .NET Web Applications |
| How to: Locate the Web Forms Controls on a Page by Walking the Controls Collection | Building ASP .NET Web Applications |
| How to: Create Instances of ASP.NET User Controls Programmatically | Building ASP .NET Web Applications |
| How to: Add PlaceHolder Web Server Controls to a Web Forms Page (Visual Studio) | Building ASP .NET Web Applications in Visual Studio |
The following code example overrides the Control.CreateChildControls method to create two controls, both instances of the custom class named ChildControl, which has a string property named Message. When created, the two controls are added to the ControlCollection. The Add method is called on each of these controls to add them to the class that contains this version of Control.CreateChildControls. The ChildControlsCreated property is set to true so that these controls will not be created again unnecessarily.
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.