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

need help on java script

I have an web form with following items:
aRadioButtonList (with two items r1, r2)

aCheckBoxList
(with four items c_r1_a, c_r1_b, c_r2_c, c_r2_d)

When r1 is checked. I want to
enable c_r1_a, c_r1_b
clear and disable c_r2_c, c_r2_d

When r2 is checked, I want
enable c_r2_c, c_r2_d
clear and disable clear and disable

I do not want to post the page back so like to do it on client side.

Thanks

John

Nov 19 '05 #1
3 860
Hi John,

ASP.NET adds its own IDs to the server controls.
So, to do this, you need to play with javascript.

get the source and see how ASP.NET is changing the IDs...
then using the IDs...you can search for that control in JS and then
disble or do whatever u like...

Let me know if I anything is unclear.
I have done it a lot of times...

Bye
Good Luck...

Nov 19 '05 #2
use the onclick event of each checkbox. set the disable and checked
property. one the issues you will run into is that disabled checks do not
post back, so to the server its the same as unchecked (which also does not
post back).
function clearAndDisable(id)
{
var e = documet.getElementById(id);
if (e)
{
e.checked = false;
e.disabled = true;
}
}
-- bruce (sqlwork.com)

"Q. John Chen" <qj****@email.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have an web form with following items:
aRadioButtonList (with two items r1, r2)

aCheckBoxList
(with four items c_r1_a, c_r1_b, c_r2_c, c_r2_d)

When r1 is checked. I want to
enable c_r1_a, c_r1_b
clear and disable c_r2_c, c_r2_d

When r2 is checked, I want
enable c_r2_c, c_r2_d
clear and disable clear and disable

I do not want to post the page back so like to do it on client side.

Thanks

John

Nov 19 '05 #3
Since there will be only 4 check boxes, this is easy

If your checkboxlist control name is CheckBoxList1 , ASP.NET gives each
check box generated an Id like CheckBoxList1_<index>

so, you could use code like below to get the check boxes from javascript

var objCheck1 = document.getElementById("CheckBoxList1_0")
var objCheck1 = document.getElementById("CheckBoxList1_1")
var objCheck2 = document.getElementById("CheckBoxList1_2")
var objCheck3 = document.getElementById("CheckBoxList1_3")

and enable/disable/check/uncheck them
"Q. John Chen" wrote:
I have an web form with following items:
aRadioButtonList (with two items r1, r2)

aCheckBoxList
(with four items c_r1_a, c_r1_b, c_r2_c, c_r2_d)

When r1 is checked. I want to
enable c_r1_a, c_r1_b
clear and disable c_r2_c, c_r2_d

When r2 is checked, I want
enable c_r2_c, c_r2_d
clear and disable clear and disable

I do not want to post the page back so like to do it on client side.

Thanks

John

Nov 19 '05 #4

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

Similar topics

4
by: lawrence | last post by:
I want to offer my friends a ping service, where certain of their pages will be called once a week. My impression is that no PHP script can be made to run very long. Assuming a situation where I...
0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
4
by: Laura P | last post by:
Hi, I wasn't sure whether this should be posted in the Java are or in a Solaris thread, so I shall post it in both. Sorry for the duplication. I am new to Solaris and am having trouble...
8
by: Johnny Knoxville | last post by:
I've added a favicon to my site (http://lazyape.filetap.com/) which works fine if you add the site to favourites the normal way, but I have some JavaScript code on a couple of pages with a link,...
0
by: Mircea Pleteriu | last post by:
Hi all, I have created a .NET Windows control with c#. I have placed the control on a HTML page within the OBJECT element. Everything works fine up to now. Now, I wanna implement the...
3
by: RC | last post by:
Dear Dudes, I post this in multiple groups for opening brain storm. Sometime I need to query the data from database server then display them into user's browser in HTML <table>. But if the...
4
by: Brie_Manakul | last post by:
I need to set up an if else to show different weather scripts based on the city selection they choose. Any help on this would be great. Thanks! <%@ page language="java" import="java.util.*,...
9
by: Mickey Segal | last post by:
The long-simmering Eolas patent dispute: http://www.microsoft.com/presspass/press/2003/oct03/10-06EOLASPR.mspx has led to an optional Microsoft Update: http://support.microsoft.com/kb/912945/en-us...
4
by: Quill_Patricia | last post by:
I have a Python script which is used to load data into a database. Up to now this script has been run by customers from the Windows command prompt using "python edg_loader.pyc". Any error messages...
0
by: tosreejithp | last post by:
Hi, My first problem was i am not able to compiled a file from java script to java class.Now its clear and working fine..now i can convert a java script file to java class by Rhino Java Script...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.