How to implement if else condition for a radio button in UI? [Resolved]

Posted by Tripati_tutu under ASP.NET on 12/15/2010 | Points: 10 | Views : 7553 | Status : [Member] | Replies : 2
Let us say, I have a radio button control called CanContact. So if it is yes then it will pass some lines of code in UI layer. If no then it will go to else part. So how can I write this in UI and how I can pass a method for this in code behind page.




Responses

Posted by: T.saravanan on: 12/15/2010 [Member] [MVP] Silver | Points: 50

Up
0
Down

Resolved
Hi,

Using RadioButton CheckedChanged event to check its check (or) not. Set AutoPostBack="true" for your radio button control.

 

protected void RadioButton_CheckedChanged(object sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if(radio.Checked == true)
{
//Call Your Method
}
else
{
//Call Your Method
}
}


For your reference...http://www.java2s.com/Code/ASP/Asp-Control/RadiobuttonautopostbackC.htm


Thanks,
T.Saravanan

Tripati_tutu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tripati_tutu on: 12/15/2010 [Member] Bronze | Points: 25

Up
0
Down
thanks for submitting solution...

Tripati_tutu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response