473,394 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Radio buttons select

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
Nov 19 '05 #1
2 1569
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.
--
Bill Jones
"tshad" wrote:
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

Nov 19 '05 #2
"Bass Pro" <Ba*****@discussions.microsoft.com> wrote in message
news:5F**********************************@microsof t.com...
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 --
Bill Jones
"tshad" wrote:
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: elhombrebala | last post by:
With this script I can force the user to select the checkbox befor continuing, but now I have a menu with lots of radio unputs and I woul like the user to select at least 2 of them; how can I check...
1
by: Rick | last post by:
After being frustrated with this issue on several occasions I think I found the secret sauce for solving the issue after reading a few different messages about what others thought and trying a...
1
by: Verner Vaz | last post by:
Select Email ID based on 'a' selected radio button Hello there, I have a simple form with some fields to be filled in and when submitted is emailed to a couple of email ID. Now, this form...
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
2
by: jimi_xyz | last post by:
Sorry if this isn't the correct group, i don't think there is a group for straight HTML. I am trying to create a type of search engine. There are two radio buttons at the top, in the middle there...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
2
by: James Gardner | last post by:
Within a single form I have a dropdown select box with 2 options and 2 radio buttons. If someone selects option 2 in the dropdown I would like to make the radio buttons disabled, such that you...
2
by: NishSF | last post by:
Would anyone have any suggestions/javascript code so that if one clicks the Radio Button "Yes" below he has the option of selecting any of the six CheckBox below. If the user clicks on Radio Button...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
7
by: gengyue | last post by:
Hi, I am running a report using Cold Fusion. This report is generated by cfloop tag. Depends on the record count of a query, the report will list the data retrieved from the database. each row in...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.