You create a Microsoft ASP.NET application by using the Microsoft .NET Framework
version 3.5.You write the following code fragment.
<asp:RadioButton ID=”RadioButton1″ runat=”server”
oncheckedchanged=”RadioButton_CheckedChanged”/>
<asp:RadioButton ID=”RadioButton2″ runat=”server”
oncheckedchanged=”RadioButton_CheckedChanged”/>
<asp:RadioButton ID=”RadioButton3″ runat=”server”
oncheckedchanged=”RadioButton_CheckedChanged”/>
You need to ensure that the following requirements are met:
Users can select only one RadioButton control at a time.
The Web page is not reloaded when a RadioButton control is selected.
What you should do?
A.
Add the following attribute for each of the RadioButton controls.
GroupName=”group1″
B.
Add the following attribute for each of the RadioButton controls.
ValidationGroup=”group1″
C.
Add the following code fragment to the RadioButton_CheckedChanged method.
(sender as RadioButton).Checked = true;
D.
Add the following code fragment to the RadioButton_CheckedChanged method.
RadioButton1.Checked = (RadioButton1 == sender);
RadioButton2.Checked = (RadioButton2 == sender);
RadioButton3.Checked = (RadioButton3 == sender);
Explanation:
The RadioButton controls GroupName property is used to group two or more mutually exclusive radio buttons.