When the aspx panel control visibility is set to false from code behind, the aspx server page removes the control from the page. It does not supply the html code for panel control and its child element to the client browser.

If you need to access the panel element on client side via javascript, it will no longer be available.

To have the aspx panel html client element still available to the DOM however, still hidden, you can do it by adding the client attribute called “hidden” as below.

The above line will add a attribute hidden to the top level Div element resulted from Panel control.

The div element can now be accessed via javascript to show/hide.

Happy developing!!!


Hide ASPX Panel control from Code-behind without losing it on the DOM.
Tagged on:     

Leave a Reply

Your email address will not be published. Required fields are marked *