Panel PlaceHolder Div Difference?

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.
 
G

Guest

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
 
T

Tommy

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,
 

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

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,200
Latest member
LaraHunley

Latest Threads

Top