Share via


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 单个列中显示列表中的所有项。

适用于

另请参阅