Another asp.net/Javascript Question

J

Joey

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.
 
K

Kevin Spencer

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.
 
T

Trevor Benedict R

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
 
N

Nanda Lella[MSFT]

Have you tried
document.getElementByID('pnlMyPanel').style.display='none';

--------------------
From: "Joey" <[email protected]>
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: <[email protected]>
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: (e-mail address removed)
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: (e-mail address removed)
Injection-Info: g47g2000cwa.googlegroups.com; posting-host=155.147.14.9;
posting-account=quLkng0AAADPxeWcCK254A0yusgzOfm6
Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.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-mail
Xref: 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top