asp.net.ph

Skip Navigation Links

Setting Layout in a RadioButtonList Control

Controls You Can Use on Web Forms   ASP.NET Standard Controls   RadioButton and RadioButtonList Controls


By default, the RadioButtonList Web server control displays a single column of buttons. However, you can specify any number of columns, and within the columns, you can specify how the items are ordered: vertically ( the default ) or horizontally. Vertical layout in three columns results in a layout such as the following:

A    D    G
B    E    H
C    F

Horizontal layout for the same items results in the following layout:

A    B    C
D    E    F
G    H

NOTE: If you are working with individual RadioButton Web server controls, you don’t set layout as a property of the control. Instead, you set it by simply adding the radio buttons within the page flow. For details about the differences between these controls, see Introduction to the RadioButton and RadioButtonList Controls.

To specify column count and ordering:

  1. Set the RadioButtonList control’s RepeatColumns property to the number of columns you want.
  2. Set the RepeatDirection property to Vertical or Horizontal. If you are setting the property in code, use the RepeatDirection enumeration, as shown in the following example:

myList.RepeatDirection = RepeatDirection.Horizontal;
  C# VB
RadioButtonList2.aspx
Run Sample | View Source
See Also

Adding Items in a List Control   Determining the Selection in a List Control   Setting the Selection in a List Control



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note