Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#4.0
I have 2 radio buttons as Male and Female. My requirement is when i select Male(Radiobutton1) the other Female(Radiobutton2) must hide

 
Please help , how to do this.

Thanks
Balamurugan
Posted 23-Jul-12 2:12am
Comments
Karthik Harve at 23-Jul-12 8:14am
   
What have you tried? Where are you facing the problem.
Karthik Harve at 23-Jul-12 8:26am
   
that example will show you how to use the Radio buttons. So, understand and code it according to your need.
Member 8070578 at 23-Jul-12 8:15am
   
Is it for web/desktop app?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

if(radiobutton1.checked)
{
  radiobutton2.Visible =false;
 
}
else if(radiobutton2.checked)
{
  radiobutton1.Visible =false;
}
  Permalink  
v2
Comments
Member 10404120 at 16-Nov-13 10:23am
   
Thanks.
If i want to hide what i was selected radiobutton.
Member 10404120 at 16-Nov-13 10:24am
   
Thanks.
But If i want to hide what i selected button.
How to do it ?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Thanks to "srnr" I got the output...
  Permalink  
Comments
CIDev at 23-Jul-12 9:28am
   
You should not post a comment to a solution as a "Solution". Instead add a comment to a previous solution by pressing the "Have a Question or Comment?" button. I did not vote, but I thought you should know why this is being downvoted.
Member 10364060 at 31-Oct-13 3:28am
   
how to select color from radio button and the change the background of selected text box in c#
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
check this[^] for how to use radio buttons.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Quote:
I have 2 radio buttons as Male and Female. My requirement is when i select Male(Radiobutton1) the other Female(Radiobutton2) must hide

Hi,
Hiding the buttons will not be the best practice always. Instead of that you can set the GroupName for both the radio button as same to select only one at a time.
 
In both radio button add this:
 
GroupName="Sex"
 
--Amit
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
                radioButton2.Hide();
        }
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 395
1 Abhinav S 235
2 Nirav Prabtani 187
3 _Amy 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,540
1 Sergey Alexandrovich Kryukov 6,597
2 Maciej Los 3,849
3 Peter Leow 3,653
4 CHill60 2,712


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 23 Jul 2012
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