Panel PlaceHolder Div Difference?

  • Thread starter Thread starter bdwise
  • Start date Start date
B

bdwise

What is the difference between a Panel and a <div> tag with
runat="server"? It seems that I can add child controls to either one
in a code-behind and they both render to a <div> anyway at runtime.

What is the difference between a Placeholder and a Div, other than a
Placeholder does not render at runtime?

Thanks.
 
When you render the PlaceHolder, you will not see a div tag, unless you add it in, of course :)

Tu-Thac
www.ongtech.co

----- bdwise wrote: ----

What is the difference between a Panel and a <div> tag wit
runat="server"? It seems that I can add child controls to either on
in a code-behind and they both render to a <div> anyway at runtime

What is the difference between a Placeholder and a Div, other than
Placeholder does not render at runtime

Thanks
 
Panel and <div> are the same thing in HTML. The difference is that a
Panel is a web control, and it makes it easier to access the control's
method and properties in the code-behind. Making a <div> runat server
also allows you to access the properties in the code-behind, but not
as much compare to a Panel web control.

A Panel control requires more processing to generate HTML, while a
<div> requires less. Which one should you use depends how much of the
properties do you need to access in the code-behind. In general, I
like to stick with plain HTML or HTML controls because they require
less processing on the server, and makes the page load smaller because
they don't use the viewstate.

Regarding to PlaceHolder and Div, if you need to apply a style to a
block of HTML, then I'll use a Div.

Tommy,
 
Back
Top