Solved

Clear radio button selection

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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