473,388 Members | 1,215 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,388 software developers and data experts.

Requires help from Super-MVP: Need JavaScript to produce behavior of radio button in 2 groups?

When we want radio button to belong to a group name we say,
radio1.GroupName="GroupA". In this case, radio1 will be unselected if
another radio button is selected in "GroupA".

Is there a way (trick, custom RadioButton, or javascript) to make radio
button (radio1) belong
to 2 independent radio button groups instead of one? This would be an
equivalent of sayting something like
radio1.GroupName1 = "GroupA";
radio1.GroupName2 = "GroupB";

Hence, whenever radio button is selected in one of the two groups, radio1 is
unselected. Also, I need a non-postBack solution. Client side
functionality, just like single Group radio button.

Thanks,
Amelyan

PS> Example of what I need to accomplish:

Imagine that you have a matrix/grid of radio buttons with, for examle,
3 rows and 3 columns.

O O O
O O O
O O O

When you check a radio button in this matrix, you don't want anything
else selected in the same row and column. One neat way to accomplish
this is if there was a way to have radio button belong to two groups,
e.g. "Row2" and "Column2".

Thanks,
-Amelyan
Nov 19 '05 #1
3 2049
You won't get this behavior from any existing controls that I'm aware of.
It certainly isn't standard radio button functionality.

The simplest solution would be to NOT use the ASP.NET controls, but just
work with the html for the buttons. In your client-side javascript then,
add the radio buttons to arrays that make up the grouping behavior you want
them to have. You can also make this a two-dimensional array so you
effectively have an array of arrays (makes it easier to loop through all
your groups/controls).

Then you'll have to write a javascript function to handle the even (onClick
or onBlur), and iterate through your arrays to get the behavior you want.

Overall, it's not as difficult as it seems. If you're going to be using
this a lot, you might want to write this functionality into a new ASP.NET
custom control. Post it on SourceForge and share it with the rest of us!

Random
"Amelyan" <ba******@wi.rr.com> wrote in message
news:uB*************@tk2msftngp13.phx.gbl...
When we want radio button to belong to a group name we say,
radio1.GroupName="GroupA". In this case, radio1 will be unselected if
another radio button is selected in "GroupA".

Is there a way (trick, custom RadioButton, or javascript) to make radio
button (radio1) belong
to 2 independent radio button groups instead of one? This would be an
equivalent of sayting something like
radio1.GroupName1 = "GroupA";
radio1.GroupName2 = "GroupB";

Hence, whenever radio button is selected in one of the two groups, radio1
is
unselected. Also, I need a non-postBack solution. Client side
functionality, just like single Group radio button.

Thanks,
Amelyan

PS> Example of what I need to accomplish:

Imagine that you have a matrix/grid of radio buttons with, for examle,
3 rows and 3 columns.

O O O
O O O
O O O

When you check a radio button in this matrix, you don't want anything
else selected in the same row and column. One neat way to accomplish
this is if there was a way to have radio button belong to two groups,
e.g. "Row2" and "Column2".

Thanks,
-Amelyan

Nov 19 '05 #2
you mean a radiobutton matrix, theres already an excellent example available
here........

http://www.virtualgeoff.com/junkyard...tonMatrix.html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Amelyan" <ba******@wi.rr.com> wrote in message
news:uB*************@tk2msftngp13.phx.gbl...
When we want radio button to belong to a group name we say,
radio1.GroupName="GroupA". In this case, radio1 will be unselected if
another radio button is selected in "GroupA".

Is there a way (trick, custom RadioButton, or javascript) to make radio
button (radio1) belong
to 2 independent radio button groups instead of one? This would be an
equivalent of sayting something like
radio1.GroupName1 = "GroupA";
radio1.GroupName2 = "GroupB";

Hence, whenever radio button is selected in one of the two groups, radio1
is
unselected. Also, I need a non-postBack solution. Client side
functionality, just like single Group radio button.

Thanks,
Amelyan

PS> Example of what I need to accomplish:

Imagine that you have a matrix/grid of radio buttons with, for examle,
3 rows and 3 columns.

O O O
O O O
O O O

When you check a radio button in this matrix, you don't want anything
else selected in the same row and column. One neat way to accomplish
this is if there was a way to have radio button belong to two groups,
e.g. "Row2" and "Column2".

Thanks,
-Amelyan

Nov 19 '05 #3
And the Super-MVP award goes to <pause> John Timney!!!

Thanks John. This is exactly what I was looking for!

Amelyan
"John Timney (ASP.NET MVP)" <ti*****@despammed.com> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
you mean a radiobutton matrix, theres already an excellent example
available here........

http://www.virtualgeoff.com/junkyard...tonMatrix.html

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Amelyan" <ba******@wi.rr.com> wrote in message
news:uB*************@tk2msftngp13.phx.gbl...
When we want radio button to belong to a group name we say,
radio1.GroupName="GroupA". In this case, radio1 will be unselected if
another radio button is selected in "GroupA".

Is there a way (trick, custom RadioButton, or javascript) to make radio
button (radio1) belong
to 2 independent radio button groups instead of one? This would be an
equivalent of sayting something like
radio1.GroupName1 = "GroupA";
radio1.GroupName2 = "GroupB";

Hence, whenever radio button is selected in one of the two groups, radio1
is
unselected. Also, I need a non-postBack solution. Client side
functionality, just like single Group radio button.

Thanks,
Amelyan

PS> Example of what I need to accomplish:

Imagine that you have a matrix/grid of radio buttons with, for examle,
3 rows and 3 columns.

O O O
O O O
O O O

When you check a radio button in this matrix, you don't want anything
else selected in the same row and column. One neat way to accomplish
this is if there was a way to have radio button belong to two groups,
e.g. "Row2" and "Column2".

Thanks,
-Amelyan


Nov 19 '05 #4

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

Similar topics

3
by: Gonçalo Rodrigues | last post by:
Hi, Ok, now I'm really confused. What is supposed super(<class>, <subclass of class>) to do? My thought was that with the following setup:
4
by: Kerim Borchaev | last post by:
Hello! Always when I use "super" I create a code duplication because class used as first arg to "super" is always the class where the method containing "super" was defined in: ''' class C:...
2
by: David MacQuigg | last post by:
I think there is a documentation error in both the Library Reference section 2.1 and the Python 2.2 Quick Reference page 19. The explanation for this function is: super( type) Returns the...
16
by: Fuzzyman | last post by:
Hello, To create a classic (old style) class, I write : class foo: pass To do the equivalent as a new style class, I write : class foo(object):
4
by: bonono | last post by:
Hi, Suppose my class definition is like this : class A: name = "A" @classmethod def foo(cls): cls.__super.foo()
4
by: John Salerno | last post by:
Here's some code from Python in a Nutshell. The comments are lines from a previous example that the calls to super replace in the new example: class A(object): def met(self): print 'A.met' ...
9
by: Mike Krell | last post by:
I'm reading Alex Martelli's "Nutshell" second edition. In the section called "Cooperative superclass method calling", he presents a diamond inheritance hierachy: class A(object): def...
5
by: Erwan Adam | last post by:
Hi all, I have a problem with the use of descriptors and super. The file is : # --------------- class Desc(object): def __init__(self, class_name): self.class_name = class_name
11
by: Rahul | last post by:
Hi Everyone, While working with Java, i came across super() which passes values to base class constructor from derived class constructor. I was wondering if this could be implemented in c++ by...
18
by: Richard Szopa | last post by:
Hello all, I am playing around w/ Python's object system and decorators and I decided to write (as an exercise) a decorator that (if applied to a method) would call the superclass' method of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
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...

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.