Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CreateControlCollection Method

LiteralControl.CreateControlCollection Method

Creates an EmptyControlCollection object for the current instance of the LiteralControl class.

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

protected override ControlCollection CreateControlCollection()

Return Value

Type: System.Web.UI.ControlCollection
The EmptyControlCollection for the current control.

By default, LiteralControl objects contain only text and no child server controls. If you want to change this behavior, you must override this method.

The following code example overrides the CreateControlCollection method to create an instance of the ControlCollection class rather than an instance of the EmptyControlCollection class.

[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
protected override ControlCollection CreateControlCollection()
   myControlCollection=new ControlCollection(this);
   return myControlCollection;

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1
© 2015 Microsoft