영어로 읽기

다음을 통해 공유


RepeatLayout 열거형

정의

List 컨트롤에 있는 항목의 레이아웃을 지정합니다.

C#
public enum RepeatLayout
상속
RepeatLayout

필드

Name Description
Flow 1

항목이 테이블 구조 없이 표시됩니다. 렌더링된 태그는 span 요소로 구성되며 항목은 br 요소로 분리됩니다.

OrderedList 3

항목이 테이블 구조 없이 표시됩니다. 렌더링된 태그는 ol 요소가 포함된 li 요소로 구성됩니다.
이 값은 ASP.NET 4의 새로운 값이며 CheckBoxListRadioButtonList 컨트롤을 위해 유일하게 유효한 옵션입니다.

Table 0

항목이 테이블에 표시됩니다.
이 옵션을 사용 하면 접근성 표준을 따르지 않을 수도 있는 HTML을 렌더링 하는 컨트롤입니다. 자세한 내용은 Visual Studio 및 ASP.NET의 내게 필요한 옵션합니다.

UnorderedList 2

항목이 테이블 구조 없이 표시됩니다. 렌더링된 태그는 ul 요소가 포함된 li 요소로 구성됩니다.
이 필드는 ASP.NET 4부터 새로운 이며에 유효한 옵션은 CheckBoxListRadioButtonList 컨트롤입니다.

예제

다음 예제에서는 열거형 값으로 레이아웃이 정의된 목록 컨트롤을 Table 보여 있습니다.

ASP.NET(C#)

<%@ Page Language="C#" AutoEventWireup="True" %>
<%@ Import Namespace="System.Data" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
   <script runat="server">
 
      ICollection CreateDataSource() 
      {
      
         // Create sample data for the DataList control.
         DataTable dt = new DataTable();
         DataRow dr;
 
         // Define the columns of the table.
         dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
         dt.Columns.Add(new DataColumn("StringValue", typeof(String)));
         dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));
         dt.Columns.Add(new DataColumn("ImageValue", typeof(String)));
 
         // Populate the table with sample values.
         for (int i = 0; i < 9; i++) 
         {
            dr = dt.NewRow();
 
            dr[0] = i;
            dr[1] = "Description for item " + i.ToString();
            dr[2] = 1.23 * (i + 1);
            dr[3] = "Image" + i.ToString() + ".jpg";
 
            dt.Rows.Add(dr);
         }
 
         DataView dv = new DataView(dt);
         return dv;
      }
 
 
      void Page_Load(Object sender, EventArgs e) 
      {

         // Load sample data only once, when the page is first loaded.
         if (!IsPostBack) 
         {
            ItemsList.DataSource = CreateDataSource();
            ItemsList.DataBind();
         }

      }
 
      void Button_Click(Object sender, EventArgs e) 
      {
 
         // Set the repeat direction based on the selected value of the
         // DirectionList DropDownList control.
         ItemsList.RepeatDirection = 
             (RepeatDirection)DirectionList.SelectedIndex;

         // Set the repeat layout based on the selected value of the
         // LayoutList DropDownList control.
         ItemsList.RepeatLayout = (RepeatLayout)LayoutList.SelectedIndex;

         // Set the number of columns to display based on the selected
         // value of the ColumnsList DropDownList control.
         ItemsList.RepeatColumns = ColumnsList.SelectedIndex;

         // Show or hide the gridlines based on the value of the
         // ShowBorderCheckBox property. Note that gridlines are displayed
         // only if the RepeatLayout property is set to Table.
         if ((ShowBorderCheckBox.Checked) 
             && (ItemsList.RepeatLayout == RepeatLayout.Table)) 
         {
            ItemsList.BorderWidth = Unit.Pixel(1);
            ItemsList.GridLines = GridLines.Both;
         }    
         else  
         {
            ItemsList.BorderWidth = Unit.Pixel(0);
            ItemsList.GridLines = GridLines.None;
         }
    
      }    
 
   </script>
 
<head runat="server">
    <title>DataList Example</title>
</head>
<body>
 
   <form id="form1" runat="server">

      <h3>DataList Example</h3>
 
      <asp:DataList id="ItemsList"
           BorderColor="black"
           CellPadding="5"
           CellSpacing="5"
           RepeatDirection="Vertical"
           RepeatLayout="Table"
           RepeatColumns="0"
           BorderWidth="0"
           runat="server">

         <HeaderStyle BackColor="#aaaadd">
         </HeaderStyle>

         <AlternatingItemStyle BackColor="Gainsboro">
         </AlternatingItemStyle>

         <HeaderTemplate>

            List of items

         </HeaderTemplate>
               
         <ItemTemplate>

            Description: <br />
            <%# DataBinder.Eval(Container.DataItem, "StringValue") %>

            <br />

            Price: <%# DataBinder.Eval(Container.DataItem, "CurrencyValue", "{0:c}") %>

            <br />

            <asp:Image id="ProductImage"
                 AlternatingText='<%# DataBinder.Eval(Container.DataItem, "StringValue") %>'
                 ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImageValue") %>'
                 runat="server"/>

         </ItemTemplate>
 
      </asp:DataList>
 
      <hr />

      <table cellpadding="5">

         <tr>

            <th>

               Repeat direction:

            </th>

            <th>

               Repeat layout:

            </th>

            <th>

               Repeat columns:

            </th>

            <th>

               <asp:CheckBox id="ShowBorderCheckBox"
                    Text="Show border"
                    Checked="False" 
                    runat="server" />

            </th>

         </tr>

         <tr>

            <td>

               <asp:DropDownList id="DirectionList" 
                    runat="server">

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

               </asp:DropDownList>

            </td>

            <td>

               <asp:DropDownList id="LayoutList" 
                    runat="server">

                  <asp:ListItem Selected="True">Table</asp:ListItem>
                  <asp:ListItem>Flow</asp:ListItem>

               </asp:DropDownList>

            </td>

            <td>

               <asp:DropDownList id="ColumnsList" 
                    runat="server">

                  <asp:ListItem Selected="True">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>5</asp:ListItem>

               </asp:DropDownList>

            </td>

            <td>

                

            </td>


         </tr>

      </table>     
         
      <asp:LinkButton id="RefreshButton" 
           Text="Refresh DataList" 
           OnClick="Button_Click" 
           runat="server"/>
 
   </form>
 
</body>
</html>

다음 예제에서는 태그에 대해 렌더링 되는 CheckBoxList 컨트롤 RepeatLayout 속성이 Flow합니다.

XAML
<span id="ctl00_MainContent_CheckBoxList1">  
  <input id="ctl00_MainContent_CheckBoxList1_0" type="checkbox"   
    name="ctl00$MainContent$CheckBoxList1$0" value="Item 1" />  
  <label for="ctl00_MainContent_CheckBoxList1_0">Item 1</label>  
  <br />  
  <input id="ctl00_MainContent_CheckBoxList1_1" type="checkbox"  
    name="ctl00$MainContent$CheckBoxList1$1" value="Item 2"/>  
  <label for="ctl00_MainContent_CheckBoxList1_1">Item 2</label>  
  <br />  
  <input id="ctl00_MainContent_CheckBoxList1_2" type="checkbox"  
    name="ctl00$MainContent$CheckBoxList1$2" value="Item 2" />  
  <label for="ctl00_MainContent_CheckBoxList1_2">Item 2</label>  
</span>  

다음 예제에서는 태그에 대해 렌더링 되는 CheckBoxList 컨트롤 RepeatLayout 속성이 OrderedList합니다.

XAML
<ol id="ctl00_MainContent_CheckBoxList3">  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList3_0" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList3$0" value="Item 1" />  
    <label for="ctl00_MainContent_CheckBoxList3_0">Item 1</label>  
  </li>  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList3_1" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList3$1" value="Item 2" />  
    <label for="ctl00_MainContent_CheckBoxList3_1">Item 2</label>  
  </li>  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList3_2" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList3$2" value="Item 2" />  
    <label for="ctl00_MainContent_CheckBoxList3_2">Item 2</label>  
  </li>  
</ol>  

다음 예제에서는 태그에 대해 렌더링 되는 CheckBoxList 컨트롤 RepeatLayout 속성이 Table합니다.

XAML
<table id="ctl00_MainContent_CheckBoxList2">  
  <tr>  
    <td>  
      <input id="ctl00_MainContent_CheckBoxList2_0" type="checkbox"  
        name="ctl00$MainContent$CheckBoxList2$0" value="Item 1" />  
      <label for="ctl00_MainContent_CheckBoxList2_0">Item 1</label>  
    </td>  
  </tr>  
  <tr>  
    <td>  
      <input id="ctl00_MainContent_CheckBoxList2_1" type="checkbox"  
        name="ctl00$MainContent$CheckBoxList2$1" value="Item 2" />  
      <label for="ctl00_MainContent_CheckBoxList2_1">Item 2</label>  
    </td>  
  </tr>  
  <tr>  
    <td>  
      <input id="ctl00_MainContent_CheckBoxList2_2" type="checkbox"  
        name="ctl00$MainContent$CheckBoxList2$2" value="Item 3" />  
      <label for="ctl00_MainContent_CheckBoxList2_2">Item 3</label>  
    </td>  
  </tr>  
</table>  

다음 예제에서는 태그에 대해 렌더링 되는 CheckBoxList 컨트롤 RepeatLayout 속성이 UnorderedList합니다.

XAML
<ul id="ctl00_MainContent_CheckBoxList4">  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList4_0" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList4$0" value="Item 1" />  
    <label for="ctl00_MainContent_CheckBoxList4_0">Item 1</label>  
  </li>  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList4_1" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList4$1" value="Item 2" />  
    <label for="ctl00_MainContent_CheckBoxList4_1">Item 2</label>  
  </li>  
  <li>  
    <input id="ctl00_MainContent_CheckBoxList4_2" type="checkbox"  
      name="ctl00$MainContent$CheckBoxList4$2" value="Item 2" />  
    <label for="ctl00_MainContent_CheckBoxList4_2">Item 2</label>  
  </li>  
</ul>  

설명

RepeatLayout 열거형 목록 컨트롤에 대 한 다른 레이아웃 옵션을 나타냅니다.

적용 대상

제품 버전
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

추가 정보