Learning Resources
 

Pushing for Choices with the RadioButton Control


Creates an individual radio button on the page. You can group multiple radio buttons together to provide a mutually exclusive set of choices.


Remarks

The RadioButton server control creates a radio button on the Web Forms page. Specify the text to display in the control by setting Text property. The text can appear either on the left or the right of the radio button. Set TextAlign property to control the side that the text appears on. You can group multiple radio buttons together if you specify the same GroupName for each RadioButton control. Grouping radio buttons together will only allow a mutually exclusive selection from the group.

Note   You can also use the RadioButtonList control. The RadioButtonList control is easier for creating a set of radio buttons using data binding, while the individual RadioButton control gives you greater control over layout.

To determine whether the RadioButton control is selected, test the Checked property.

CAUTION   Text is not HTML encoded before it is displayed in the RadioButton control. This makes it possible to embed script within HTML tags in the text. If the values for the control come from user input, be sure to validate the values to help prevent security vulnerabilities.

For detailed information on the RadioButton Web server control's properties and events, see the RadioButton Class documentation.