473,847 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Checking individual Radio Buttons with the same GroupName doesn't work

In standard HTML, the <INPUT type="radio" name="x" /control only
allows one radio button to be checked at a time. When more than one
are set as checked="true" then only the last one rendered appears as
checked. I would assume that asp:RadioButton objects that share the
same GroupName would not allow more than one Radio Button to be checked
(similar to the Radio Button List) but it seems to not be the case. If
I set one Radio Button's Checked property to True and then another one,
they both render HTML as Checked. Is this a bug or are
asp:RadioButton s supposed to work like this? At this point, the
workaround is to require setting of all RadioButtons' Checked property
to False in case any were previously True before setting the desired
RadioButton's Checked property to True.

Example:
<%@ Page Language="VB" AutoEventWireup ="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArg s) Handles Me.Load
Me.RadioButton2 .Checked = True
Me.RadioButton1 .Checked = True ' You'd think this would uncheck
RadioButton2
End Sub
</script>
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RadioButto n ID="RadioButton 1" runat="server"
GroupName="Test Group" Text="Radio Button 1" />
<asp:RadioButto n ID="RadioButton 2" runat="server"
GroupName="Test Group" Text="Radio Button 2" /></div>
</form>
</body>
</html>

Jul 31 '06 #1
0 1417

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

Similar topics

1
3510
by: John Mullen | last post by:
I want to take the following HTLM and use javascript to turn on radio buttons if checkbox is checked, can I do this with javascript (maybe onClick or an array) or do i need a server side script ? <li>ABACAVIR SULFATE</li> <INPUT NAME="ingredient0" TYPE=checkbox VALUE="ABACAVIR SULFATE"><br> <input name="ABACAVIR SULFATE AMOUNT" type="radio" value="EQ 300MG BASE">EQ 300MG BASE<br> <input name="ABACAVIR SULFATE AMOUNT" type="radio" value="EQ...
3
2289
by: Jay | last post by:
I noticed somewhere on the net that a post mentioned that there was a bug in the datagrid, radio buttons and a repeater. Something about the radio buttons are not mutually exclusive. (will this be fixed soon) I am trying to create a survey form where the 4 radio buttons are created dynamically for each question in the database. Is there an example of this somewhere. The radio buttons are based on a seperate table called survey answers....
1
1108
by: Chris Tremblay | last post by:
I want to use a Repeater control to display a bunch of records. Got that part figured out. Now I want each record to have next to it a radio button so I can select exactly one record and then click "next". I'm using <asp:RadioButton> to create the radio button, but when the page is rendered each button has a different name and therefore the browser doesn't group them together as it should and I can select as many as I'd like. I've...
2
5436
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and I want to be able to retrieve the selected value from each of the sets of radio buttons.The names of each group of radio buttons is set by the database and I don't know how to retrieve the values because I don't know the names of these radio...
2
1773
by: tshad | last post by:
I have 2 radio buttons: <asp:RadioButton ID="radDetail" GroupName="detailSummary" Text="Detail" checkedChanged="RadDetail_Clicked" runat="server" /> <asp:RadioButton ID="radSummary" GroupName="detailSummary" Text="Summary" checkedChanged="RadSummary_Clicked" runat="server" /> </p> I want to have RadDetail_Click or RadSummary_Click executed as soon as the radio button is clicked.
2
1588
by: tshad | last post by:
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.
3
2537
by: SamSpade | last post by:
FOR WINDOWS FORMS I've been setting all Radio buttons in a group to Checked=False except the clicked one which I set to True. I just noticed the GroupName property and if I understand the doc it will do that for me automatically. Is that correct? I would not post for the above (I could just try). The reason for this post
4
1126
by: David Thielen | last post by:
Hi; I want to have two radio buttons that are both in cell 0 of subsequent rows of a table. But in row 0 of the table in cell 1 I have another pair of radio buttons. These two pairs are totally distinct. How can I set this up? -- thanks - dave
22
7993
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I am using getElelementsByName since these are radio buttons, but it seems that the dynamic element is not seen!!! This is my code... please let me know if there is anything that I am doing wrong! - thanks ---- ....
0
9890
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10990
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10652
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10346
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7887
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5724
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4537
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3167
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.