Groups > Asp .Net > Getting started with ASP.NET > Re: Check to see if radio button list is selected




Check to see if radio button list is selected

Check to see if radio button list is selected
Thu, 3 Apr 2008 14:55:55 +0000
I have a radio button list with 2 options.  There is also a checkbox below the
list in case the user does not want to choose either of the given options, they
can enter their own.  How can I check to see if anything in the radiobuttonlist
is selected?  If there is nothing selected, I'd like to get the value in the
text box.
Post Reply
Re: Check to see if radio button list is selected
Thu, 3 Apr 2008 15:04:03 +0000
you can check

if(RadiobuttonList.SelectedIndex == -1)

 then TextBox1.Text
Post Reply
Re: Check to see if radio button list is selected
Thu, 3 Apr 2008 18:47:22 +0000
Thanks!
Post Reply
Re: Check to see if radio button list is selected
Thu, 3 Apr 2008 19:48:06 +0000
if no options is selected, the SelectedIndex of RadioButtonList is -1, but, what
is the checkbox's use below the list?  you can get the value in the text box if
the checkbox is checked, hehe.
Post Reply
Re: Check to see if radio button list is selected
Thu, 3 Apr 2008 21:14:05 +0000
Oops, I meant "textbox", not "checkbox"
Post Reply
about | contact