System.Web.UI.WebControls Namespace
Renders a radio button control.
Visibility |
Constructor |
Parameters |
public |
RadioButton |
( )
|
Visibility |
Name |
Value Type |
Accessibility |
public |
GroupName
|
String |
[ Get , Set ] |
|
Use the RadioButton class to create a control that allows the user to select either a true or false state.
You can group RadioButton controls together by specifying a common GroupName property for each radio button that you want to include in the group.
NOTE: When you group RadioButton controls together, only one radio button in the group can be selected at a time.
To determine whether the control is selected, use the Checked property. If you have a group of radio button controls, you need to loop through the controls and test the Checked property of each control individually.
The RadioButton control provides a CheckedChanged event that is raised when the Checked property changes value between posts to the server. This allows you to define an event handler to perform a custom set of instructions each time the event is raised.
The RadioButton control does not automatically post back to the server when clicked. You must provide another control on the Web page that supports posting to the server, such as a Button control, or set the AutoPostback property to true to automatically send the state of the control back to the server.
If you need to use multiple RadioButton controls, the RadioButtonList is an alternative control that provides convenient data binding capabilities. Individual RadioButton controls, though, provide greater control over layout.
For examples illustrating use of this control, see the individual member types of this class. For syntax information, see RadioButton in ASP.NET Syntax for Web Controls.
CheckBox CheckBoxList RadioButtonList