RadioButtonList.RepeatDirection 属性

定义

获取或设置组内单选按钮的显示方向。

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; }
public virtual System.Web.UI.WebControls.RepeatDirection RepeatDirection { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.RepeatDirection : System.Web.UI.WebControls.RepeatDirection with get, set
member this.RepeatDirection : System.Web.UI.WebControls.RepeatDirection with get, set
Public Overridable Property RepeatDirection As RepeatDirection

属性值

RepeatDirection

RepeatDirection 值之一。 默认值为 Vertical

属性

例外

列表的显示方向不是 RepeatDirection 值之一。

示例

下面的代码示例演示如何使用 RepeatDirection 该属性在填充到顶部的列中显示控件的 RadioButtonList 项,然后从左到右。

<%@ 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 显示方向。

备注

显示的列数始终由 RepeatColumns 属性确定。

如果此属性设置为RepeatDirection.VerticalRepeatLayout并且属性设置为Table,则第一列从上到下填充,然后是下一列,直到呈现所有项为止。 例如,如果 RepeatColumns 设置为 3,控件 RadioButtonList 的项会显示在三列中。 如下所示显示九项列表。

1 4 7
2 5 8
3 6 9

如果此属性设置为RepeatDirection.HorizontalRepeatLayout并且属性设置为Table,则列表中的项显示在从左到右加载的行中,然后从上到下,直到呈现所有项。 例如,如果 RepeatColumns 设置为 3,控件 RadioButtonList 的项将显示在三个项目的行中。 如下所示显示九项列表。

1 2 3
4 5 6
7 8 9

适用于

另请参阅