Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I would like to be able to check/select a radiobutton and then uncheck/deselect(if they select the wrong filed by chance) . Is there a way to do this in asp.net?
Posted 25-Jan-11 0:20am
Edited 25-Jan-11 1:37am
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

I will suggest you to use Checkbox control where you can actually do what you have asked.
But radio button is only that you want to use refer following code :
 
        bool blnState;
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void radioButton1_MouseDown(object sender, MouseEventArgs e)
        {
            blnState = radioButton1.Checked;
        }
 
        private void radioButton1_MouseUp(object sender, MouseEventArgs e)
        {
            radioButton1.Checked = !blnState;
        }
 
where radioButton1 is the name of the radio button that you are using.
I have used the mousedown and mouseup events of this control.
  Permalink  
Comments
sam, atlanta at 31-Jan-11 13:08pm
   
It worked correctly pravin...
Pravin Patil, Mumbai at 1-Feb-11 1:19am
   
congrats sam
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

can u explain clear
 
-----
 
i think, this is help u use Radio Button List and Select Autopostback true.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Are you talking about OnCheckedChanged event[^]
 
As said by Vinoth you need to set autopostback property to true.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Schatak 394
1 OriginalGriff 355
2 Sergey Alexandrovich Kryukov 119
3 _Amy 115
4 Rob Philpott 100
0 OriginalGriff 7,097
1 Sergey Alexandrovich Kryukov 5,623
2 Maciej Los 3,504
3 Peter Leow 3,373
4 DamithSL 2,505


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 25 Jan 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100