You must Sign In to post a response.

How to uncheck the radio button in C#

Hi,

I have 3 radio buttons in my c# form.

by default when i run the form, the first radio button is selected.

i want all the 3 radio buttons to be unchecked when i run that page.

pls suggest me the code..

and then i should select based on the requirements


Comments

Author: Asheej T K13 Apr 2010 Member Level: Gold   Points : 2

Remove "Selected="True" code from the RadioButtonList.

Author: Vikram Singh Saini13 Apr 2010 Member Level: Gold   Points : 2

Hi,

I got the solution.


private void Form1_Load(object sender, EventArgs e)
{
this.radioButton1.TabStop = false;
this.radioButton2.TabStop = false;
this.radioButton3.TabStop = false;
this.radioButton4.TabStop = false;

}



(dont forget to rate)
Thanks and Regards,
Vikram Singh Saini

Author: MuhiReks13 Apr 2010 Member Level: Gold   Points : 2

while design mode set the checked property = false
or
On_Pageload

radiobtn.checked=flase
radiobtn1.checked=flase
radiobtn2.checked=flase

But if you have only radio button in your form , change TabIndex property to other value , because wen ever page load the focus wil be in TabIndex 0 , so automatically it will focus the radio button.

so set tabindex 0 to other control if you have in the form instead of radio

Author: Sanjay C13 Apr 2010 Member Level: Gold   Points : 2

by default radio button checked property is false.
and you write on page load event
rd1.checked=false;
rd2.checked=false;
rd3.checked=false;



thanks & regards

sanjay.c

Author: paul10013 Apr 2010 Member Level: Gold   Points : 2

private void Form1_Activated(object sender, EventArgs e)
{
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
}

Author: shamala14 Apr 2010 Member Level: Gold   Points : 2

Just write a statement, like this rdn.checked=false

Author: Vikram Singh Saini14 Apr 2010 Member Level: Gold   Points : 2

Hi,

To each and everyone answered!

He asked for making all radiobuttons checked to false. Even if you apply
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
still one of the radiobutton will be checked on running the application based on the priority of tab index.

Let me know your opinions and thoughts on this.

(dont forget to rate)
Thanks and Regards,
Vikram Singh Saini

Author: Aparna16 Apr 2010 Member Level: Silver   Points : 2

on page load

rb1.Checked = False;
rb2.Checked = False;
rb2.Checked = False;

Author: asdfg16 Apr 2010 Member Level: Gold   Points : 2

Hi Vikram Singh Saini
I think u had mistaken

Please check it once