How to: Add RadioButtonList Web Server Controls to a Web Forms Page
You can add a radio button to a Web Forms page in two ways:
-
By adding a RadioButtonList Web server control and then adding individual list items to the control.
-
By adding an individual RadioButton Web server control.
Note
This topic addresses how to add a RadioButtonList Web server control and then add individual list items to the control. For information about adding an individual RadioButton Web server control, see How to: Add RadioButton Web Server Controls to a Web Forms Page.
For details about the differences between these approaches, see RadioButton and RadioButtonList Web Server Controls Overview.
When you use a RadioButtonList control, you add a single control to the page. Adding items to the control is a separate process that depends on whether you will display a static list in the control or a list generated dynamically at run time.
To add a RadioButtonList Web server control to a Web Forms page
-
From the Standard tab of the Toolbox, drag a RadioButtonList control onto the page.
-
Optionally, in the Properties window, change the orientation of the caption by setting the TextAlign property.
-
Optionally, change the layout of the control to display multiple columns. For details, see How to: Set Layout in a RadioButtonList Web Server Control.
-
Create items for the control in one of the following ways:
-
By creating them as individual items. For details, see How to: Add Items in List Web Server Controls.
-
By binding data to the control. For details, see How to: Populate List Web Server Controls from a Data Source.
-