LiteralControl.CreateControlCollection メソッド

定義

EmptyControlCollection クラスの現在のインスタンスの LiteralControl オブジェクトを作成します。

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

戻り値

現在のコントロールの EmptyControlCollection

次のコード例では、 メソッドを CreateControlCollection オーバーライドして、 クラスの ControlCollection インスタンスではなく、 クラスのインスタンスを EmptyControlCollection 作成します。

[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

注釈

既定では、 LiteralControl オブジェクトにはテキストのみが含まれており、子サーバー コントロールは含まれます。 この動作を変更する場合は、このメソッドをオーバーライドする必要があります。

適用対象

こちらもご覧ください