minglelinch
asked on
Clear radio button selection
I have a Yes/No choice radio button defined -
<td align="left" valign="top">
<asp:Panel ID="Panel4" GroupingText="Use other Choice:" Font-Size="Small" BorderColor="#F4FAFE" ForeColor="Black" runat="server" Width="180px">
<asp:RadioButtonList ID="RadioOther" runat="server" Width="150px" RepeatDirection="Horizonta l" onclick= "SelectOther()">
<asp:ListItem Value="Yes">Yes</asp:ListI tem>
<asp:ListItem Value="No">No</asp:ListIte m>
</asp:RadioButtonList>
</asp:Panel>
</td>
Assume the user select a radio choice Yes, and the Reset button need to deselect any option in the radio group. In C#, I used -
RadioOther.Checked = false or RadioOther.checked = false
to clear the selection, and it does not work. Actually I got compile error.
How can I clear the selection? Thanks.
<td align="left" valign="top">
<asp:Panel ID="Panel4" GroupingText="Use other Choice:" Font-Size="Small" BorderColor="#F4FAFE" ForeColor="Black" runat="server" Width="180px">
<asp:RadioButtonList ID="RadioOther" runat="server" Width="150px" RepeatDirection="Horizonta
<asp:ListItem Value="Yes">Yes</asp:ListI
<asp:ListItem Value="No">No</asp:ListIte
</asp:RadioButtonList>
</asp:Panel>
</td>
Assume the user select a radio choice Yes, and the Reset button need to deselect any option in the radio group. In C#, I used -
RadioOther.Checked = false or RadioOther.checked = false
to clear the selection, and it does not work. Actually I got compile error.
How can I clear the selection? Thanks.
I see, there are compiled errors;
Try to check your spellings or Caps or maybe radio buttons has the same names.
Try to check your spellings or Caps or maybe radio buttons has the same names.
I'm nt sure abt this but can u try chklst.SelectedIndex = -1;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
foreach(ListItem item in RadioOther.Items)
{
item.Selected = false;
}