RadioButtonList.RepeatDirection 属性

定义

获取或设置组中单选按钮的显示方向。Gets or sets the direction in which the radio buttons within the group are displayed.

public:
 virtual property System::Web::UI::WebControls::RepeatDirection RepeatDirection { System::Web::UI::WebControls::RepeatDirection get(); void set(System::Web::UI::WebControls::RepeatDirection value); };
[System.ComponentModel.Bindable(true)]
public virtual System.Web.UI.WebControls.RepeatDirection RepeatDirection { get; set; }
member this.RepeatDirection : System.Web.UI.WebControls.RepeatDirection with get, set
Public Overridable Property RepeatDirection As RepeatDirection

属性值

RepeatDirection 值之一。One of the RepeatDirection values. 默认值为 VerticalThe default is Vertical.

属性

异常

列表的显示方向不是 RepeatDirection 值之一。The display direction of the list is not one of the RepeatDirection values.

示例

下面的代码示例演示如何使用RepeatDirection属性来以从上到下、从左到右的列显示RadioButtonList控件的项。The following code example demonstrates how to use the RepeatDirection property to display the items of a RadioButtonList control in columns filled top to bottom, and then left to right.

<%@ Page Language="C#" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.RepeatDirection Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatLayout="Table"
      RepeatColumns = "2" 
      RepeatDirection="Vertical" 
      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:RadioButtonList>
</body>
</html>   
<%@ Page Language="VB" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.RepeatDirection Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatLayout="Table"
      RepeatColumns = "2" 
      RepeatDirection="Vertical" 
      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:RadioButtonList>
</body>
</html>   

注解

使用此属性可指定RadioButtonList控件的显示方向。Use this property to specify the display direction of the RadioButtonList control.

备注

显示的列数始终由RepeatColumns属性确定。The number of columns that are displayed is always determined by the RepeatColumns property.

如果将此属性设置为RepeatDirection.Vertical ,并且RepeatLayout属性设置为Table,则将从上到下填充第一列,然后填充第二列,直到呈现所有项。If this property is set to RepeatDirection.Vertical and if the RepeatLayout property is set to Table, the first column is filled from top to bottom, then the next column, and so on until all items are rendered. 例如,如果RepeatColumns设置为3,则RadioButtonList控件的项将显示在三列中。For example, if RepeatColumns is set to 3, the items of the RadioButtonList control are displayed in three columns. 将显示一个九项列表,如下所示。A nine-item list would appear as follows.

11 44 77
22 55 88
33 66 99

如果将此属性设置为RepeatDirection.Horizontal ,并且RepeatLayout属性设置为Table,则列表中的项将以从左到右、从上到下的行显示,直到呈现所有项。If this property is set to RepeatDirection.Horizontal and if the RepeatLayout property is set to Table, the items in the list are displayed in rows loaded left to right, then top to bottom, until all items are rendered. 例如,如果RepeatColumns设置为3,则RadioButtonList控件的项将显示在三个项的行中。For example, if RepeatColumns is set to 3, the items of the RadioButtonList control are displayed in rows of three items. 将显示一个九项列表,如下所示。A nine-item list would appear as follows.

11 22 33
44 55 66
77 88 99

适用于

另请参阅