Control.CreateChildControls メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Control.CreateChildControls メソッドの意味・解説 

Control.CreateChildControls メソッド

ASP.NET ページ フレームワークによって呼び出されコンポジション ベース実装使用するサーバー コントロールに、ポスト バックまたは表示のための準備として、格納するコントロール作成するように通知します

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Friend Overridable
 Sub CreateChildControls
Me.CreateChildControls
protected internal virtual void CreateChildControls
 ()
protected public:
virtual void CreateChildControls ()
protected void CreateChildControls ()
protected internal function
 CreateChildControls ()
解説解説
使用例使用例

CreateChildControls メソッドオーバーライドされたバージョンの例を次に示します。この実装では、複合コントロールは、HTML表示する 2 つリテラル コントロール囲まれTextBox コントロール表示します

' Override CreateChildControls to create the control tree.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand,
 Name:="Execution")> _
Protected Overrides Sub
 CreateChildControls()
   
   ' Add a LiteralControl to the current ControlCollection.
   Me.Controls.Add(New LiteralControl("<h3>Value:
 "))
   
   
   ' Create a text box control, set the default Text property, 
   ' and add it to the ControlCollection.
   Dim box As New TextBox()
   box.Text = "0"
   Me.Controls.Add(box)
   
   Me.Controls.Add(New LiteralControl("</h3>"))
End Sub 'CreateChildControls
// Override CreateChildControls to create the control tree.
 [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand,
 Name="Execution")]
 protected override void CreateChildControls()
 {

     // Add a LiteralControl to the current ControlCollection.
     this.Controls.Add(new LiteralControl("<h3>Value:
 "));


     // Create a text box control, set the default Text property, 
     // and add it to the ControlCollection.
     TextBox box = new TextBox();
     box.Text = "0";
     this.Controls.Add(box);

     this.Controls.Add(new LiteralControl("</h3>"));
 }

// Override CreateChildControls to create the control tree.
/** @attribute System.Security.Permissions.PermissionSet(
    System.Security.Permissions.SecurityAction.Demand, Name = "Execution")
 */
protected void CreateChildControls()
{
    // Add a LiteralControl to the current ControlCollection.
    this.get_Controls().Add(new LiteralControl("<h3>Value:
 "));
    // Create a text box control, set the default Text property, 
    // and add it to the ControlCollection.
    TextBox box = new TextBox();
    box.set_Text("0");
    this.get_Controls().Add(box);

    this.get_Controls().Add(new LiteralControl("</h3>"));
} //CreateChildControls
// Override CreateChildControls to create the control tree.
 protected override function CreateChildControls()
 
 {

     // Add a LiteralControl to the current ControlCollection.
     this.Controls.Add(new LiteralControl("<h3>Value:
 "));

     // Create a text box control, set the default Text property, 
     // and add it to the ControlCollection.
     var box : TextBox = new TextBox();
     box.Text = "0";
     this.Controls.Add(box);

     this.Controls.Add(new LiteralControl("</h3>"));
 }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からControl.CreateChildControls メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からControl.CreateChildControls メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からControl.CreateChildControls メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Control.CreateChildControls メソッド」の関連用語

Control.CreateChildControls メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Control.CreateChildControls メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS