RadioButtonList.RepeatColumns 屬性

定義

取得或設定要顯示在 RadioButtonList 控制項中的資料行數目。

public:
 virtual property int RepeatColumns { int get(); void set(int value); };
[System.ComponentModel.Bindable(true)]
public virtual int RepeatColumns { get; set; }
public virtual int RepeatColumns { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.RepeatColumns : int with get, set
member this.RepeatColumns : int with get, set
Public Overridable Property RepeatColumns As Integer

屬性值

要顯示在 RadioButtonList 中的資料行數目。 預設值為 0,表示這個屬性未設定。

屬性

例外狀況

行數設定為負值。

範例

下列程式碼範例示範如何使用 RepeatColumns 屬性,在兩個 RadioButtonList 資料行中顯示控制項的專案。

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

<asp:RadioButtonList id="RadioButtonList1"
      RepeatLayout="Table"
      RepeatColumns = "2" 
      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.RepeatColumns Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatLayout="Table"
      RepeatColumns = "2" 
      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>

備註

當 屬性 RepeatLayout 設定為 Table 時,您可以使用這個屬性來指定控制項中 RadioButtonList 顯示專案的資料行數目。 如果未設定這個屬性, RadioButtonList 控制項就會在單一資料行中顯示清單中的所有專案。

適用於

另請參閱