Solved

Clear radio button selection

Posted on 2011-02-16
4
673 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now