Another asp.net/Javascript Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joey

    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.

  • Kevin Spencer

    #2
    Re: Another asp.net/Javascript Question

    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" <joey.powell@to pscene.com> wrote in message
    news:1138809987 .734682.147690@ g47g2000cwa.goo glegroups.com.. .[color=blue]
    >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.
    >[/color]


    Comment

    • Trevor Benedict R

      #3
      Re: Another asp.net/Javascript Question

      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" <joey.powell@to pscene.com> wrote in message
      news:1138809987 .734682.147690@ g47g2000cwa.goo glegroups.com.. .[color=blue]
      >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.
      >[/color]


      Comment

      • Nanda Lella[MSFT]

        #4
        RE: Another asp.net/Javascript Question

        Have you tried
        document.getEle mentByID('pnlMy Panel').style.d isplay='none';

        --------------------[color=blue]
        >From: "Joey" <joey.powell@to pscene.com>
        >Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
        >Subject: Another asp.net/Javascript Question
        >Date: 1 Feb 2006 08:06:27 -0800
        >Organization : http://groups.google.com
        >Lines: 16
        >Message-ID: <1138809987.734 682.147690@g47g 2000cwa.googleg roups.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[/color]
        16:06:33 GMT)[color=blue]
        >X-Complaints-To: groups-abuse@google.co m
        >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;[/color]
        ..NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1; .NET CLR
        1.0.3705),gzip( gfe),gzip(gfe)[color=blue]
        >Complaints-To: groups-abuse@google.co m
        >Injection-Info: g47g2000cwa.goo glegroups.com; posting-host=155.147.14 .9;
        > posting-account=quLkng0 AAADPxeWcCK254A 0yusgzOfm6
        >Path:[/color]
        TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!ne wsfeed00.sul.t-online.de!t-onli
        ne.de!border2.n ntp.dca.giganew s.com!nntp.giga news.com!novia! news-pusher.read
        news.com!198.18 6.190.247.MISMA TCH!news-out.readnews.co m!news-xxxfer.readnews
        ..com!postnews. google.com!g47g 2000cwa.googleg roups.com!not-for-mail[color=blue]
        >Xref: TK2MSFTNGXA02.p hx.gbl microsoft.publi c.dotnet.framew ork.aspnet:3750 32
        >X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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.
        >
        >[/color]

        --

        Thank You,
        Nanda Lella,

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

        Comment

        • sloan

          #5
          Re: Another asp.net/Javascript Question

          Check



          They have an example there.





          "Joey" <joey.powell@to pscene.com> wrote in message
          news:1138809987 .734682.147690@ g47g2000cwa.goo glegroups.com.. .[color=blue]
          > 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.
          >[/color]


          Comment

          Working...