共用方式為


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.Vertical 為 ,而且 RepeatLayout 屬性設定 Table 為 ,則第一個資料行會從上到下填滿,則下一個資料行等,直到轉譯所有專案為止。 例如,如果 RepeatColumns 設定為 3,控制項的專案 RadioButtonList 會顯示在三個數據行中。 九個專案清單會顯示如下。

1 4 7
2 5 8
3 6 9

如果此屬性設定為 ,而且 RepeatLayout 屬性設定 RepeatDirection.Horizontal Table 為 ,則清單中的專案會顯示在由左至右載入的資料列中,直到轉譯所有專案為止。 例如,如果 RepeatColumns 設定為 3,控制項的專案 RadioButtonList 會顯示在三個專案的資料列中。 九個專案清單會顯示如下。

1 2 3
4 5 6
7 8 9

適用於

另請參閱