This documentation is archived and is not being maintained.

RadioButtonList.RepeatDirection Property

Gets or sets the direction that the radio buttons within the group are displayed.

[Visual Basic]
Public Overridable Property RepeatDirection As RepeatDirection
[C#]
public virtual RepeatDirection RepeatDirection {get; set;}
[C++]
public: __property virtual RepeatDirection get_RepeatDirection();
public: __property virtual void set_RepeatDirection(RepeatDirection);
[JScript]
public function get RepeatDirection() : RepeatDirection;
public function set RepeatDirection(RepeatDirection);

Property Value

One of the RepeatDirection values. The default is Vertical.

Exceptions

Exception Type Condition
ArgumentException The display direction of the list is not one of the RepeatDirection values.

Remarks

Use this property to specify the display direction of the RadioButtonList control.

Note   The number of columns displayed is always determined by the RepeatColumns property.

If this property is set to RepeatDirection.Vertical, the items in the list are displayed in columns loaded top to bottom, then left to right, until all items are rendered. For example, if RepeatColumns is set to three, the items of the RadioButtonList control are displayed in three columns.

1 4 7
2 5 8
3 6  

If this property is set to RepeatDirection.Horizontal, the items in the list are displayed in rows loaded left to right, then top to bottom, until all items are rendered. For example, if RepeatColumns is set to three, the items of the RadioButtonList control are displayed in rows of three items.

1 2 3
4 5 6
7 8  

Example

[Visual Basic, C#, JScript] The following example demonstrates how to use the RepeatDirection property to display the items of a RadioButtonList in columns filled top to bottom, then left to right.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>

<asp:RadioButtonList id=RadioButtonList1
      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>


[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>

<asp:RadioButtonList id=RadioButtonList1
      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>


[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>

<asp:RadioButtonList id=RadioButtonList1
      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>

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

RadioButtonList Class | RadioButtonList Members | System.Web.UI.WebControls Namespace | RepeatDirection | RepeatColumns

Show: