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

Another asp.net/Javascript Question

I am going to use a collection of either div HTML server controls or
panel web server controls (renders as div on newer browsers) on a web
form. I need to be able to hide them with a client-side javascript
switch block, based upon what is selected in a drop-down list web
server control (renders as HTML select on newer browsers).

I have found that the following does not work for HTML div elements...

document.all['pnlMyPanel'].style.display='none';

....but it always worked for other controls like label/span, dropdown
list/select, etc...

Do you guys have any suggestions on how to handle this? I really
appreciate your help.

Feb 1 '06 #1
4 1213
You have to use the ClientID, not the Control ID.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am going to use a collection of either div HTML server controls or
panel web server controls (renders as div on newer browsers) on a web
form. I need to be able to hide them with a client-side javascript
switch block, based upon what is selected in a drop-down list web
server control (renders as HTML select on newer browsers).

I have found that the following does not work for HTML div elements...

document.all['pnlMyPanel'].style.display='none';

...but it always worked for other controls like label/span, dropdown
list/select, etc...

Do you guys have any suggestions on how to handle this? I really
appreciate your help.

Feb 1 '06 #2
Joey,
The easiet way to debug these issues is to View the Source of the HTML
(disable SMARTNAVIGATION for this to work) and then you will see the actual
HTML. Sometimes, I just save this result as another HTML file and then fix
the issue and port the Client side code to the ASP.NET Form.

HTH

Regards,

Trevor Benedict R

"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am going to use a collection of either div HTML server controls or
panel web server controls (renders as div on newer browsers) on a web
form. I need to be able to hide them with a client-side javascript
switch block, based upon what is selected in a drop-down list web
server control (renders as HTML select on newer browsers).

I have found that the following does not work for HTML div elements...

document.all['pnlMyPanel'].style.display='none';

...but it always worked for other controls like label/span, dropdown
list/select, etc...

Do you guys have any suggestions on how to handle this? I really
appreciate your help.

Feb 1 '06 #3
Have you tried
document.getElementByID('pnlMyPanel').style.displa y='none';

--------------------
From: "Joey" <jo*********@topscene.com>
Newsgroups: microsoft.public.dotnet.framework.aspnet
Subject: Another asp.net/Javascript Question
Date: 1 Feb 2006 08:06:27 -0800
Organization: http://groups.google.com
Lines: 16
Message-ID: <11**********************@g47g2000cwa.googlegroups .com>
NNTP-Posting-Host: 155.147.14.9
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1138809993 13485 127.0.0.1 (1 Feb 2006 16:06:33 GMT)X-Complaints-To: gr**********@google.com
NNTP-Posting-Date: Wed, 1 Feb 2006 16:06:33 +0000 (UTC)
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; ..NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR
1.0.3705),gzip(gfe),gzip(gfe)Complaints-To: gr**********@google.com
Injection-Info: g47g2000cwa.googlegroups.com; posting-host=155.147.14.9;
posting-account=quLkng0AAADPxeWcCK254A0yusgzOfm6
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews. com!novia!news-pusher.read
news.com!198.186.190.247.MISMATCH!news-out.readnews.com!news-xxxfer.readnews
..com!postnews.google.com!g47g2000cwa.googlegroups .com!not-for-mailXref: TK2MSFTNGXA02.phx.gbl microsoft.public.dotnet.framework.aspnet:375032
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet

I am going to use a collection of either div HTML server controls or
panel web server controls (renders as div on newer browsers) on a web
form. I need to be able to hide them with a client-side javascript
switch block, based upon what is selected in a drop-down list web
server control (renders as HTML select on newer browsers).

I have found that the following does not work for HTML div elements...

document.all['pnlMyPanel'].style.display='none';

...but it always worked for other controls like label/span, dropdown
list/select, etc...

Do you guys have any suggestions on how to handle this? I really
appreciate your help.


--

Thank You,
Nanda Lella,

This Posting is provided "AS IS" with no warranties, and confers no rights.

Feb 2 '06 #4
Check
http://aspnet.4guysfromrolla.com/articles/091504-1.aspx
They have an example there.

"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
I am going to use a collection of either div HTML server controls or
panel web server controls (renders as div on newer browsers) on a web
form. I need to be able to hide them with a client-side javascript
switch block, based upon what is selected in a drop-down list web
server control (renders as HTML select on newer browsers).

I have found that the following does not work for HTML div elements...

document.all['pnlMyPanel'].style.display='none';

...but it always worked for other controls like label/span, dropdown
list/select, etc...

Do you guys have any suggestions on how to handle this? I really
appreciate your help.

Feb 2 '06 #5

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
3
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I...
3
by: Peter | last post by:
Hello, Two newbie questions: 1) I have a javascript file with a function in it. From this function I want to access a variable in another javascript file -which is not inside a function. I...
1
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
5
by: Magnus | last post by:
Hi! This is my problem: I want to go from page1 to page2, and to get all the form variables from page1 to page2. I have turned the viewstate and the sessionstate off, and i really just...
5
by: Chris | last post by:
I thought this would be simple and there would be advice / tutorials everywhere for this, but now that I'm working on it, I can't find any reference except for ASP or Javascript code. PHP/MySQL - ...
3
by: Darrin | last post by:
I've seen a couple threads on this that did not answer my question and I could not add a post to them. I've inherited a web application that is going to be replaced in the coming months. For the...
13
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python...
11
by: emailscotta | last post by:
Below I declared a basic object literal with 2 methods. The "doSomething" method is call from the "useDoSomething" method but the call is only sucessful if I use the "this" keyword or qualify the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.