System.Web.UI.WebControls Namespace RadioButton Class
Sets or retrieves the name of the group that the radio button belongs to.
Inline |
<asp:radiobutton groupname = strName ... > |
Script |
RadioButton.GroupName [ = strName ] |
strName |
String specifying The name of the group that the radio button belongs to. |
The property is read/write with no default value.
Use the GroupName property to specify a grouping of radio buttons to create a mutually exclusive set of controls. The property can be used when only one selection is possible from a list of available options, as in the case of gender.
When this property is set, only one RadioButton in the specified group can be selected at a time.
The following example illustrates how to set the GroupName property of radio button controls at design time.
<h5>The first president of the United States was:</h5>
<table>
<tr><td>
<asp:RadioButton id = "Radio1" Text = "Abraham Lincoln"
GroupName = "choices" runat = "server" /><br>
<asp:RadioButton id = "Radio2" Text = "Christopher Columbus"
GroupName = "choices" runat = "server" /><br>
<asp:RadioButton id = "Radio3" Text = "George Washington"
GroupName = "choices" runat = "server" /><br>
<asp:RadioButton id = "Radio4" Text = "Robert Plant"
GroupName = "choices" runat = "server" /><br>
</td></tr>
</table>
<p><asp:button text = "Submit" onClick = "chkAnswer" runat = "server" />
Show me
RadioButton Members