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

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

Table.CreateControlCollection メソッド

現在の Table コントロールの TableRow コントロール保持する新しい ControlCollection オブジェクト作成します

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

Protected Overrides Function
 CreateControlCollection As ControlCollection
Dim returnValue As ControlCollection

returnValue = Me.CreateControlCollection
protected override ControlCollection CreateControlCollection ()
protected:
virtual ControlCollection^ CreateControlCollection () override
protected ControlCollection CreateControlCollection ()
protected override function CreateControlCollection
 () : ControlCollection

戻り値
現在の Table コントロールTableRow コントロール格納する ControlCollection オブジェクト

解説解説

このメソッドは、カスタム クラスTable コントロールか派生させる場合に、主にコントロール開発者によって使用されます。

このメソッドは、Control 基本クラスの CreateControlCollection 実装オーバーライドます。Table コントロールについては、CreateControlCollection は、現在の Table コントロールTableRow コントロールだけを格納できる ControlCollection を常に返します

使用例使用例

カスタム サーバー コントロールCreateControlCollection メソッドオーバーライドし、Table の EmptyControlCollection クラスについて、常に新しインスタンス返されるようにする方法コード例次に示します

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page Language="VB" AutoEventWireup="True"
 %>
<HTML>
    <HEAD>
        <title>Custom Table - CreateControlCollection - VB.NET Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post"
 runat="server">
            <h3>Custom Table - CreateControlCollection - VB.NET Example</h3>

            <aspSample:CustomTableCreateControlCollection id="Table1"
 runat="server" 
             GridLines="Both" CellPadding="4">
                <asp:TableRow>
                    <asp:TableCell>Row 0, Col 0</asp:TableCell>
                    <asp:TableCell>Row 0, Col 1</asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell>Row 1, Col 0</asp:TableCell>
                    <asp:TableCell>Row 1, Col 1</asp:TableCell>
                </asp:TableRow>
            </aspSample:CustomTableCreateControlCollection>
        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br
 />Imports System.Web
Imports System.Security.Permissions

Namespace Samples.AspNet.VB.Controls
    <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)>
 _
    Public NotInheritable Class
 CustomTableCreateControlCollection
        Inherits System.Web.UI.WebControls.Table

        Protected Overrides Function
 CreateControlCollection() As System.Web.UI.ControlCollection

            ' Return a new EmptyControlCollection
            Return New System.Web.UI.EmptyControlCollection(Me)
        End Function
    End Class
End Namespace
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page Language="C#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom Table - CreateControlCollection - C# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom Table - CreateControlCollection - C# Example</h3>

            <aspSample:CustomTableCreateControlCollection 
              id="Table1" 
              runat="server" 
              GridLines="Both" 
              CellPadding="4">
        <asp:TableRow>
          <asp:TableCell>Row 0, Col 0</asp:TableCell>
          <asp:TableCell>Row 0, Col 1</asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
          <asp:TableCell>Row 1, Col 0</asp:TableCell>
          <asp:TableCell>Row 1, Col 1</asp:TableCell>
        </asp:TableRow>
      </aspSample:CustomTableCreateControlCollection>
      
        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br />using
 System.Web;
using System.Security.Permissions;

namespace Samples.AspNet.CS.Controls
{
  [AspNetHostingPermission(SecurityAction.Demand, Level=AspNetHostingPermissionLevel.Minimal)]
  public sealed class CustomTableCreateControlCollection
 : System.Web.UI.WebControls.Table
  {
    protected override System.Web.UI.ControlCollection CreateControlCollection()
    {
      // Return a new EmptyControlCollection
      return new System.Web.UI.EmptyControlCollection(this);
    }
  }
}
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
    <HEAD>
        <title>Custom Table - CreateControlCollection - VJ# Example</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server">
            <h3>Custom Table - CreateControlCollection - VJ# Example</h3>

            <aspSample:CustomTableCreateControlCollection 
              id="Table1" 
              runat="server" 
              GridLines="Both" 
              CellPadding="4">
        <asp:TableRow>
          <asp:TableCell>Row 0, Col 0</asp:TableCell>
          <asp:TableCell>Row 0, Col 1</asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
          <asp:TableCell>Row 1, Col 0</asp:TableCell>
          <asp:TableCell>Row 1, Col 1</asp:TableCell>
        </asp:TableRow>
      </aspSample:CustomTableCreateControlCollection>
      
        </form>
    </body>
</HTML>
<br /><span space="preserve">...</span><br />package
 Samples.AspNet.JSL.Controls; 

public class CustomTableCreateControlCollection
    extends System.Web.UI.WebControls.Table
{
    protected System.Web.UI.ControlCollection CreateControlCollection()
    {
        // Return a new EmptyControlCollection
        return new System.Web.UI.EmptyControlCollection(this);
    } //CreateControlCollection
} //CustomTableCreateControlCollection
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
Table クラス
Table メンバ
System.Web.UI.WebControls 名前空間
TableRow
ControlCollection
その他の技術情報
Table、TableRow、TableCell の各 Web サーバー コントロール


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS