CheckBoxList.RepeatLayout プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As CheckBoxList Dim value As RepeatLayout value = instance.RepeatLayout instance.RepeatLayout = value
public: virtual property RepeatLayout RepeatLayout { RepeatLayout get (); void set (RepeatLayout value); }
/** @property */ public RepeatLayout get_RepeatLayout () /** @property */ public void set_RepeatLayout (RepeatLayout value)
public function get RepeatLayout () : RepeatLayout public function set RepeatLayout (value : RepeatLayout)
RepeatLayout 値の 1 つ。既定値は Table です。


このプロパティを使用して、CheckBoxList コントロールの項目をテーブル内に表示するかどうかを指定します。このプロパティを RepeatLayout.Table に設定すると、リストの項目はテーブル内に表示されます。このプロパティを RepeatLayout.Flow に設定すると、リストの項目はテーブル構造なしで表示されます。

RepeatLayout プロパティを使用して、テーブル構造なしで CheckBoxList コントロールを表示する方法のコード例を次に示します。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。各コード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script language="VB" runat="server"> Sub Check_Clicked(sender As Object, e As EventArgs) Dim i As Integer Message.Text = "Selected Item(s):<br><br>" For i=0 To checkboxlist1.Items.Count - 1 If checkboxlist1.Items(i).Selected Then Message.Text += checkboxlist1.Items(i).Text + "<br>" End If Next End Sub </script> </head> <body> <form action="checkboxlist.aspx" method="post" runat="server"> <h3>CheckBoxList Example</h3> <asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Flow" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"> <asp:ListItem>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> </asp:CheckBoxList> <br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script language="C#" runat="server"> void Check_Clicked(Object sender, EventArgs e) { Message.Text = "Selected Item(s):<br><br>"; for (int i=0; i<checkboxlist1.Items.Count; i++) { if (checkboxlist1.Items[i].Selected) Message.Text += checkboxlist1.Items[i].Text + "<br>"; } } </script> </head> <body> <form action="checkboxlist.aspx" method="post" runat="server"> <h3>CheckBoxList Example</h3> <asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Flow" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"> <asp:ListItem>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> </asp:CheckBoxList> <br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> <script language="JScript" runat="server"> function Check_Clicked(sender : Object, e : EventArgs) { Message.Text = "Selected Item(s):<br><br>"; for (var i : int = 0; i<checkboxlist1.Items.Count; i++) { if (checkboxlist1.Items[i].Selected) Message.Text += checkboxlist1.Items[i].Text + "<br>"; } } </script> </head> <body> <form action="checkboxlist.aspx" method="post" runat="server"> <h3>CheckBoxList Example</h3> <asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Flow" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"> <asp:ListItem>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> </asp:CheckBoxList> <br><br> <asp:label id="Message" runat="server"/> </form> </body> </html>
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Check_Clicked(sender as Object, e As EventArgs) Message.Text = "Selected Item(s):<br><br>" ' Iterate through the Items collection of the CheckBoxList ' control and display the selected items. Dim i As Integer For i=0 To checkboxlist1.Items.Count - 1 If checkboxlist1.Items(i).Selected Then Message.Text &= checkboxlist1.Items(i).Text & "<br>" End If Next End Sub Sub Index_Change(sender as Object, e As EventArgs) ' Set the layout (table or flow) of the CheckBoxList control. checkboxlist1.RepeatLayout = CType(List.SelectedIndex, RepeatLayout) End Sub </script> </head> <body> <form runat="server"> <h3> CheckBoxList RepeatLayout Example </h3> Select items from the CheckBoxList. <br><br> <asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Table" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"> <asp:ListItem>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> </asp:CheckBoxList> <br><br> <asp:label id="Message" runat="server"/> <hr> Select whether to display the CheckBoxList control in table or flow layout. <table cellpadding="5"> <tr> <td> RepeatLayout: </td> </tr> <tr> <td> <asp:DropDownList id="List" AutoPostBack="True" OnSelectedIndexChanged="Index_Change" runat="server"> <asp:ListItem Selected="True">Table</asp:ListItem> <asp:ListItem>Flow</asp:ListItem> </asp:DropDownList> </td> </tr> </table> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Check_Clicked(Object sender, EventArgs e) { Message.Text = "Selected Item(s):<br><br>"; // Iterate through the Items collection of the CheckBoxList // control and display the selected items. for (int i=0; i<checkboxlist1.Items.Count; i++) { if (checkboxlist1.Items[i].Selected) { Message.Text += checkboxlist1.Items[i].Text + "<br>"; } } } void Index_Change(Object sender, EventArgs e) { // Set the layout (table or flow) of the CheckBoxList control. checkboxlist1.RepeatLayout = (RepeatLayout)List.SelectedIndex; } </script> </head> <body> <form runat="server"> <h3> CheckBoxList RepeatLayout Example </h3> Select items from the CheckBoxList. <br><br> <asp:CheckBoxList id="checkboxlist1" AutoPostBack="True" CellPadding="5" CellSpacing="5" RepeatColumns="2" RepeatDirection="Vertical" RepeatLayout="Table" TextAlign="Right" OnSelectedIndexChanged="Check_Clicked" runat="server"> <asp:ListItem>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> </asp:CheckBoxList> <br><br> <asp:label id="Message" runat="server"/> <hr> Select whether to display the CheckBoxList control in table or flow layout. <table cellpadding="5"> <tr> <td> RepeatLayout: </td> </tr> <tr> <td> <asp:DropDownList id="List" AutoPostBack="True" OnSelectedIndexChanged="Index_Change" runat="server"> <asp:ListItem Selected="True">Table</asp:ListItem> <asp:ListItem>Flow</asp:ListItem> </asp:DropDownList> </td> </tr> </table> </form> </body> </html>

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCheckBoxList.RepeatLayout プロパティを検索する場合は、下記のリンクをクリックしてください。

- CheckBoxList.RepeatLayout プロパティのページへのリンク