CheckBoxList.RepeatDirection プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > CheckBoxList.RepeatDirection プロパティの意味・解説 

CheckBoxList.RepeatDirection プロパティ

コントロール平または垂直のどちらで表示するかを指定する値を取得または設定します

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

Public Overridable Property
 RepeatDirection As RepeatDirection
Dim instance As CheckBoxList
Dim value As RepeatDirection

value = instance.RepeatDirection

instance.RepeatDirection = value
public virtual RepeatDirection RepeatDirection { get;
 set; }
public:
virtual property RepeatDirection RepeatDirection {
    RepeatDirection get ();
    void set (RepeatDirection value);
}
/** @property */
public RepeatDirection get_RepeatDirection ()

/** @property */
public void set_RepeatDirection (RepeatDirection
 value)
public function get RepeatDirection
 () : RepeatDirection

public function set RepeatDirection
 (value : RepeatDirection)

プロパティ
RepeatDirection 値の 1 つ既定値Vertical です。

例外例外
例外種類条件

ArgumentException

指定したリスト表示方向が、RepeatDirection 値ではありません。

解説解説

このプロパティ使用して、CheckBoxList コントロール表示方向指定します

メモメモ

表示する列数は、常に RepeatColumns プロパティによって決定されます。

このプロパティRepeatDirection.Vertical設定した場合リストの項目は上から下、左から右、の順に最後の項目まで表示されます。たとえば、リスト コントロールRepeatColumns プロパティ3設定すると、CheckBoxList コントロールの項目は次の表のように 3 列に表示されます。

1

4

7

2

5

8

3

6

9

このプロパティRepeatDirection.Horizontal設定した場合リストの項目は左から右の順番で、上の行から順に最後の項目まで表示されます。たとえば、RepeatColumns プロパティ3設定すると、CheckBoxList コントロールの項目は次の表のように 3 行に表示されます。

1

2

3

4

5

6

7

8

9

使用例使用例

RepeatDirection プロパティ使用して表示方向垂直に設定する方法コード例次に示します

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。各コード サンプルは、拡張子.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 direction that the items are rendered in the 
         ' CheckBoxList control.
         checkboxlist1.RepeatDirection = _
             CType(List.SelectedIndex, RepeatDirection)

      End Sub

   </script>
 
</head>

<body>
   
   <form runat="server">
 
      <h3> CheckBoxList RepeatDirection 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 the direction to render the CheckBoxList
 items.

      <table cellpadding="5">

         <tr>

            <td>

               RepeatDirection:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="List"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Index_Change"
                    runat="server">

                  <asp:ListItem>Horizontal</asp:ListItem>
                  <asp:ListItem Selected="True">Vertical</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 direction that the items are rendered in the 
         // CheckBoxList control.
         checkboxlist1.RepeatDirection = (RepeatDirection)List.SelectedIndex;

      }

   </script>
 
</head>

<body>
   
   <form runat="server">
 
      <h3> CheckBoxList RepeatDirection 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 the direction to render the CheckBoxList items.

      <table cellpadding="5">

         <tr>

            <td>

               RepeatDirection:

            </td>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="List"
                    AutoPostBack="True"
                    OnSelectedIndexChanged="Index_Change"
                    runat="server">

                  <asp:ListItem>Horizontal</asp:ListItem>
                  <asp:ListItem Selected="True">Vertical</asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>

      </table>
             
   </form>
          
</body>

</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
CheckBoxList クラス
CheckBoxList メンバ
System.Web.UI.WebControls 名前空間
CheckBoxList.RepeatColumns プロパティ
RepeatLayout
その他の技術情報
CheckBox Web サーバー コントロールおよび CheckBoxList Web サーバー コントロール


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

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

辞書ショートカット

すべての辞書の索引

「CheckBoxList.RepeatDirection プロパティ」の関連用語

CheckBoxList.RepeatDirection プロパティのお隣キーワード
検索ランキング

   

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



CheckBoxList.RepeatDirection プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS