How to not render a Panel Control as a <div>

GibboK picture GibboK · Sep 19, 2011 · Viewed 10.7k times · Source

I use Asp.net 4 and C#.

I have a common web control <asp:Panel>. It is my understanding that if the Panel is visible it renders in the Browser as a <div></div> tag.

I would like to know if is possible to change this behavior and display the content of the Panel without rendering its <div>.

  • Any idea how to do it?
  • Can I use another control instead of Panel?

An example of code would be appreciated thanks!

Answer

Royi Namir picture Royi Namir · Sep 19, 2011

Simple :

use PlaceHolder or  Literal

it renders only what it has - nothing more nothing less.