1

What is the best approach to show and hide an asp panel which is containing other controls like textbox and label controls

2 Answers 2

4

Using jQuery, you can just switch visibilty:

$('#<%= YourPanel.ClientID %>').hide();
$('#<%= YourPanel.ClientID %>').show();

Edit: jQuery is probably overkill just to hide/show, but if you plan to add more functionality client side, you should consider using it ;)

Sign up to request clarification or add additional context in comments.

2 Comments

I would even recommend setting the panel's ClientIDMode to static.
Good idea to get rid of the asp.net tag soup (if he use .NET 4.0)
3

Can you try

document.getElementById( 'Panel1ClientId' ).style.display = 'none'; // to hide

and

document.getElementById( 'Panel1ClientId' ).style.display = 'block'; // to show

?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.