The RadioButton control creates an individual radio button on the page. You can group multiple radio buttons to present mutually exclusive choices.
Note You can also use the RadioButtonList control. The RadioButtonList control is easier for data binding, while the individual RadioButton control gives you greater control over the layout of the controls.
Required properties are noted in boldface type.
<asp:RadioButton id="RadioButton1" runat="server" AutoPostBack="True|False" Checked="True|False" GroupName="GroupName" Text="label" TextAlign="Right|Left" OnCheckedChanged="OnCheckedChangedMethod" />
Note Because the <asp:RadioButton> element has no content, you can close it with />.
Property | Description |
---|---|
(Base control properties) | The properties defined in Base Web Control Properties. |
AutoPostBack | true if client-side changes in the control automatically cause a postback to the server; false otherwise. The default is false. |
Checked | true if the radio button is checked, false otherwise. The default is false. |
GroupName | The name of a group to which the radio button belongs. Radio buttons with the same group name are mutually exclusive. |
TextAlign | The position of the caption. Possible values are Right and Left" The default is Right.
When programming, you set this property using the TextAlign enumeration. |
Text | The radio button caption. |
Event (and paramters) | Description |
---|---|
OnCheckedChanged(Object sender, EventArgs e) | Raised when the user clicks the radio button. This event does not cause the Web Forms page to be posted to the server unless the AutoPostBack property is set to true.
The e events argument object has no properties. |
To be supplied.
See Also