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

#492870    Author: Asheej T K      13 Apr 2010 Member Level: Gold   Points : 2

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



Regards,
Asheej T K
Microsoft MVP[ASP.NET/IIS]
DotNetSpider MVM

#492884    Author: Vikram Singh Saini    13 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

RESULTS MATTER, REASONS NOT!

#492886    Author: MuhiReks    13 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


hope this help!

thnx
Muhil

#493118    Author: Sanjay C    13 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

#493131    Author: paul100  13 Apr 2010 Member Level: Gold   Points : 2

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


Regards

#493472    Author: shamala  14 Apr 2010 Member Level: Gold   Points : 2

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


Subhashini

#493637    Author: Vikram Singh Saini    14 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


RESULTS MATTER, REASONS NOT!

#494609    Author: Aparna  16 Apr 2010 Member Level: Silver   Points : 2

on page load

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


Aparna Bhise

#494619    Author: asdfg  16 Apr 2010 Member Level: Gold   Points : 2

Hi Vikram Singh Saini
I think u had mistaken

Please check it once


This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.