Radio buttons select

T

tshad

I have 2 radio buttons set to yes or no:

<asp:RadioButton id="RelocateYes" Checked="true" GroupName="Relocate"
runat="server" Text="Yes"/>
<asp:RadioButton id="RelocateNo" GroupName="Relocate" runat="server"
Text="No"/>

This is set as a group so that you can only choose one button. If you
choose the other button, the first button will unselect.

This doesn't seem to work if you do it programmatically.

For example, if I do:

if not (emailReader("Relocate") is DBNull.Value) then
RelocateYes.Checked = emailReader("Relocate")
end if

Assume that RelocateYes is selected, so RelocateNo is not.

If the data is 0, then RelocatYes will be unchecked. I would assume that
RelocateNo would be checked - but it doesn't. Is there a way have it behave
this way, or do I have to set both buttons manually?

Thanks,

Tom
 
G

Guest

Hello Tom,
I would suggest using the RadioButtonList control. It is much easier to
setup and retrieve user actions. You only deal with one control.
 
T

tshad

Bass Pro said:
Hello Tom,
I would suggest using the RadioButtonList control. It is much easier to
setup and retrieve user actions. You only deal with one control.

I do that in some places.

The problem is that the RadioButtonList is set up as a table and you can't
put the text next to the table (not sure why), it always goes below that
text in a table cell. I fought this for awhile before just switching to the
other control.

Of couse, as I mention in my other post, I can't seem to set the radioButton
programmatically, when there are more that 2 (not sure if that is the reason
or not). The last one ends up being set, for some reason.

Tom
 

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,994
Messages
2,570,223
Members
46,811
Latest member
SaulFernan

Latest Threads

Top