A check box displays a single option that the user can either check or uncheck and radio buttons present a group of options from which the user can select just one option.
To create a group of radio buttons, you specify the same name for the GroupName attribute of each radio button in the group. If more than one group is required in a single form, then specify a different group name for each group.
If you want check box or radio button to be selected when the form is initially displayed, set its Checked attribute to true. If the Checked attribute is set to true for multiple radio buttons in a group, then only the last one is considered as true.
Basic syntax of check box:
<asp:CheckBox ID= "chkoption" runat= "Server"> </asp:CheckBox>
Basic syntax of radio button:
<asp:RadioButton ID= "rdboption" runat= "Server"> </asp: RadioButton>
Common properties of check boxes and radio buttons:
Properties | Description |
---|---|
Text | The text displayed next to the check box or radio button. |
Checked | Specifies whether it is selected or not, default is false. |
GroupName | Name of the group the control belongs to. |