Rediger

Del via


LiteralControl.CreateControlCollection Method

Definition

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

protected:
 override System::Web::UI::ControlCollection ^ CreateControlCollection();
protected override System.Web.UI.ControlCollection CreateControlCollection ();
override this.CreateControlCollection : unit -> System.Web.UI.ControlCollection
Protected Overrides Function CreateControlCollection () As ControlCollection

Returns

The EmptyControlCollection for the current control.

Examples

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;
}
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Function CreateControlCollection() As ControlCollection
   myControlCollection = New ControlCollection(Me)
   Return myControlCollection
End Function 'CreateControlCollection

Remarks

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

Applies to

See also