Hiding and redisplaying an ASP.NET Panel

Discussion in 'ASP .Net' started by Matt, Oct 26, 2009.

  1. Matt

    Matt Guest

    Hi,

    I'm writing an ASP.NET website which has a page containing a
    Panel. I want the user to be able
    to hide/display the panel at will by clicking a tickbox.

    I have written some javascript code which either hides or displays the
    panel when the tickbox is
    clicked, which is working fine. Eg. It uses the following to hide the
    panel:

    pnlAdvancedSearch.style.display = 'none';

    The problem comes when the form does a postback. If the panel is
    hidden before the postback
    occurs, then when the page is redrawn it doesn't display the panel (as
    you'd expect). But then, clicking the tickbox results in a javascript
    error, because it now doesn't recognize what the the panel
    "pnlAdvancedSearch" is.

    I'm probably doing this completely the wrong way. Can anyone give me
    any advice?

    Thanks,

    Matt
    Matt, Oct 26, 2009
    #1
    1. Advertising

  2. Matt <> wrote in news:737bf390-3021-461c-a997-
    :

    > I'm writing an ASP.NET website which has a page containing a
    > Panel. I want the user to be able
    > to hide/display the panel at will by clicking a tickbox.


    Consider trying the AJAX Toolkit Accordion Panel. It is very easy to
    implement and you can reconstitute the state with a postback.

    Peace and Grace,

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
    Gregory A. Beamer, Oct 26, 2009
    #2
    1. Advertising

  3. Matt

    Matt Guest


    >
    > Consider trying the AJAX Toolkit Accordion Panel. It is very easy to
    > implement and you can reconstitute the state with a postback.
    >


    Thanks, I'll give it a go.

    Matt
    Matt, Oct 28, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    6
    Views:
    6,315
    Wanda Li
    Mar 18, 2005
  2. Miles Davenport
    Replies:
    1
    Views:
    6,803
    Bryce
    Oct 8, 2004
  3. Sharon Lee
    Replies:
    2
    Views:
    528
    Fredo Vincentis
    Jan 4, 2004
  4. dotnetjunkie
    Replies:
    2
    Views:
    1,608
    priyadharsini
    May 6, 2008
  5. Ste
    Replies:
    41
    Views:
    805
    Thomas 'PointedEars' Lahn
    Aug 1, 2007
Loading...

Share This Page