CheckBoxList.CellSpacing プロパティとは何? わかりやすく解説 Weblio辞書

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

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

CheckBoxList.CellSpacing プロパティ

セル間の間隔 (ピクセル単位) を取得または設定します

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

解説解説
使用例使用例

CellSpacing プロパティ使用してCheckBoxList コントロールセルに 5 ピクセル余白指定する方法コード例次に示します

メモメモ

次のコード サンプルはシングルファイル コード モデル使用しており、分離コード ファイル直接コピーされ場合正常に動作しない可能性あります。各コード サンプルは、拡張子.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 cell padding and cell spacing based on the selection
         ' from the drop down-list controls. Notice that cell padding
 and 
         ' cell spacing only applies when the RepeatLayout property
 is set
         ' to RepeatLayout.Table.
         checkboxlist1.CellPadding = CellPaddingList.SelectedIndex
         checkboxlist1.CellSpacing = CellSpacingList.SelectedIndex

      End Sub

   </script>
 
</head>

<body>
   
   <form runat="server">
 
      <h3> CheckBoxList CellPadding and CellSpacing 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 different values for the cell
 padding and cell spacing.

      <table cellpadding="5">

         <tr>

            <td>

               CellPadding:

            </td>

            <td>

               CellSpacing:

            </td>

         </tr>

         <tr>

            <td>

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

                  <asp:ListItem>0</asp:ListItem>
                  <asp:ListItem>1</asp:ListItem>
                  <asp:ListItem>2</asp:ListItem>
                  <asp:ListItem>3</asp:ListItem>
                  <asp:ListItem>4</asp:ListItem>
                  <asp:ListItem Selected="True">5</asp:ListItem>

               </asp:DropDownList>

            </td>

            <td>

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

                  <asp:ListItem>0</asp:ListItem>
                  <asp:ListItem>1</asp:ListItem>
                  <asp:ListItem>2</asp:ListItem>
                  <asp:ListItem>3</asp:ListItem>
                  <asp:ListItem>4</asp:ListItem>
                  <asp:ListItem Selected="True">5</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 cell padding and cell spacing based on the selection
         // from the drop-down list controls. Notice that cell padding
 and 
         // cell spacing only applies when the RepeatLayout property
 is set
         // to RepeatLayout.Table.
         checkboxlist1.CellPadding = CellPaddingList.SelectedIndex;
         checkboxlist1.CellSpacing = CellSpacingList.SelectedIndex;

      }

   </script>
 
</head>

<body>
   
   <form runat="server">
 
      <h3> CheckBoxList CellPadding and CellSpacing 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 different values for the cell padding and cell spacing.

      <table cellpadding="5">

         <tr>

            <td>

               CellPadding:

            </td>

            <td>

               CellSpacing:

            </td>

         </tr>

         <tr>

            <td>

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

                  <asp:ListItem>0</asp:ListItem>
                  <asp:ListItem>1</asp:ListItem>
                  <asp:ListItem>2</asp:ListItem>
                  <asp:ListItem>3</asp:ListItem>
                  <asp:ListItem>4</asp:ListItem>
                  <asp:ListItem Selected="True">5</asp:ListItem>

               </asp:DropDownList>

            </td>

            <td>

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

                  <asp:ListItem>0</asp:ListItem>
                  <asp:ListItem>1</asp:ListItem>
                  <asp:ListItem>2</asp:ListItem>
                  <asp:ListItem>3</asp:ListItem>
                  <asp:ListItem>4</asp:ListItem>
                  <asp:ListItem Selected="True">5</asp:ListItem>

               </asp:DropDownList>

            </td>

         </tr>

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

</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2024 GRAS Group, Inc.RSS