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

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

CheckBoxList.CreateControlStyle メソッド

すべてのスタイル関連プロパティ実装するために CheckBoxList コントロール内部使用するスタイル オブジェクト作成します

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

解説解説

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

使用例使用例

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

<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.VB.Controls"
 Assembly="Samples.AspNet.VB"
 %>
<%@ Page language="VB" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - CreateControlStyle - VB.NET Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post"
 runat="server">
      <h3>Custom CheckBoxList - CreateControlStyle - VB.NET Example</h3>
      <aspSample:CustomCheckBoxListCreateControlStyle id="CheckBoxList"
 runat="server"
       RepeatLayout="Table" RepeatColumns="2"
 CellSpacing="3" CellPadding="3">
                <asp:ListItem  Selected="True">Item
 1</asp:ListItem>
                <asp:ListItem>Item 2</asp:ListItem>
                <asp:ListItem>Item 3</asp:ListItem>
                <asp:ListItem>Item 4</asp:ListItem>
                <asp:ListItem>Item 5</asp:ListItem>
                <asp:ListItem>Item 6</asp:ListItem>
            </aspSample:CustomCheckBoxListCreateControlStyle>
    </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
 CustomCheckBoxListCreateControlStyle
        Inherits System.Web.UI.WebControls.CheckBoxList

        Protected Overrides Function
 CreateControlStyle() As System.Web.UI.WebControls.Style

            ' Initializes and return a new instance of the TableStyle
 class.
            Return New System.Web.UI.WebControls.TableStyle(Me.ViewState)
        End Function
    End Class
End Namespace
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.CS.Controls"
 Assembly="Samples.AspNet.CS" %>
<%@ Page language="c#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - CreateControlStyle - C# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBoxList - CreateControlStyle - C# Example</h3>

      <aspSample:CustomCheckBoxListCreateControlStyle
        id="CheckBoxList1"
        runat="server"
        RepeatLayout="Table"
        RepeatColumns="2"
        CellSpacing="3"
        CellPadding="3">
        <asp:ListItem  Selected="True">Item 1</asp:ListItem>
        <asp:ListItem>Item 2</asp:ListItem>
        <asp:ListItem>Item 3</asp:ListItem>
        <asp:ListItem>Item 4</asp:ListItem>
        <asp:ListItem>Item 5</asp:ListItem>
        <asp:ListItem>Item 6</asp:ListItem>
      </aspSample:CustomCheckBoxListCreateControlStyle>

    </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 CustomCheckBoxListCreateControlStyle
 : System.Web.UI.WebControls.CheckBoxList
    {
        protected override System.Web.UI.WebControls.Style CreateControlStyle()
        {
        // Initializes and return a new instance of the TableStyle class.
        return new System.Web.UI.WebControls.TableStyle(this.ViewState);
        }
    }
}
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls"
 Assembly="Samples.AspNet.JSL" %>
<%@ Page language="VJ#" %>
<HTML>
  <HEAD>
    <title>Custom CheckBoxList - CreateControlStyle - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      <h3>Custom CheckBoxList - CreateControlStyle - VJ# Example</h3>

      <aspSample:CustomCheckBoxListCreateControlStyle
        id="CheckBoxList1"
        runat="server"
        RepeatLayout="Table"
        RepeatColumns="2"
        CellSpacing="3"
        CellPadding="3">
        <asp:ListItem  Selected="True">Item 1</asp:ListItem>
        <asp:ListItem>Item 2</asp:ListItem>
        <asp:ListItem>Item 3</asp:ListItem>
        <asp:ListItem>Item 4</asp:ListItem>
        <asp:ListItem>Item 5</asp:ListItem>
        <asp:ListItem>Item 6</asp:ListItem>
      </aspSample:CustomCheckBoxListCreateControlStyle>

    </form>
  </body>
</HTML>
<br /><span space="preserve">...</span><br />package
 Samples.AspNet.JSL.Controls;

public class CustomCheckBoxListCreateControlStyle
    extends System.Web.UI.WebControls.CheckBoxList
{
    protected System.Web.UI.WebControls.Style CreateControlStyle()
    {
        // Initializes and return a new instance of the TableStyle class.
        return new System.Web.UI.WebControls.TableStyle(this.get_ViewState());
    } //CreateControlStyle
} //CustomCheckBoxListCreateControlStyle
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS