Solved

Clear radio button selection

Posted on 2011-02-16
4
685 Views
Last Modified: 2012-06-21
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="Horizontal" onclick= "SelectOther()">                      
                        <asp:ListItem  Value="Yes">Yes</asp:ListItem>
                        <asp:ListItem  Value="No">No</asp:ListItem>
                   </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.
0
Comment
Question by:minglelinch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 8

Expert Comment

by:TheMozz
ID: 34907334
One way is to iterate the list of items and set the selected property to false:

foreach(ListItem item in RadioOther.Items)
{
     item.Selected = false;
}
0
 
LVL 14

Expert Comment

by:systan
ID: 34907413
I see, there are compiled errors;
Try to check your spellings or Caps or maybe radio buttons has the same names.
0
 
LVL 20

Expert Comment

by:informaniac
ID: 34907435
I'm nt sure abt this but can u try chklst.SelectedIndex = -1;
0
 
LVL 20

Accepted Solution

by:
informaniac earned 500 total points
ID: 34907530
I'm nt sure abt this but can u try chklst.SelectedIndex = -1;
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question