Hiding and redisplaying an ASP.NET Panel

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

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
 
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! |
*******************************************
 
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
 

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

Back
Top