CheckBoxList.CreateControlStyle メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim returnValue As Style returnValue = Me.CreateControlStyle
コントロールのスタイルのプロパティを格納する Style。


カスタム サーバー コントロールの 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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CheckBoxList クラス
CheckBoxList メンバ
System.Web.UI.WebControls 名前空間
その他の技術情報
CheckBox Web サーバー コントロールおよび CheckBoxList Web サーバー コントロール
Weblioに収録されているすべての辞書からCheckBoxList.CreateControlStyle メソッドを検索する場合は、下記のリンクをクリックしてください。

- CheckBoxList.CreateControlStyle メソッドのページへのリンク