Difference between Panel control and Div

Viren picture Viren · Sep 20, 2010 · Viewed 38.9k times · Source

I want to know what is difference between Panel control in asp.net and div with runat="server"? Since both render as a div.

Which one is best (conditions)?

Answer

balexandre picture balexandre · Sep 20, 2010

The code

<asp:Panel id="abc" runat="server">

is exactly the same as if you do:

<div id="abc" runat="server">

They render the same, but it's the functionality with other WebControls that the Panel is most used, and the Panel web control gives you more control under code-behind as it exposes more properties.