changes with Radiobutton selection

V

Vinnie

I placed the following code into my page, but i get an error message,
why?

The code is:
if (this.RadioButtonContatto.Checked == "YES")

The error message is:
CS0117: 'System.Web.UI.WebControls.RadioButtonList' does not contain a
definition for 'Checked'

Where is the error? what else should i use for the radiobutton
selection changes?

Thanks
 
T

Troye Stonich

'Checked' is a bool property of the RadioButtonList.

So, you would replace that with

if (this.RadioButtonContatto.Checked)
{
...
}
 
V

Vinnie

'Checked' is a bool property of the RadioButtonList.

So, you would replace that with

if (this.RadioButtonContatto.Checked)
{
...

}


Ok, thanks, but i have two options: how do i make the system do
something if one of this two options is selected?

For example: if selected YES, do this, else do something else.

My problem is that having a Radiobutton list, i need the system do
something only if the YES button is checked.

Thanks
 
T

Troye Stonich

ok sorry, you'll have to look at the "SelectedValue" string property of the
RadioButtonList.

if (this.RadioButtonContatto.SelectedValue == "YES")
{
...
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top