Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Panel control and Div

Tags:

asp.net

panel

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)?

like image 897
Viren Avatar asked Sep 20 '10 09:09

Viren


People also ask

What is DIV in ASP?

The Div control is used to specify a container that groups content into logical sections on Web page. The Div control also enables you to apply CSS (cascading style sheet) rules to content of the control.

What is the purpose of using panel control?

The Panel control is used as a container for other controls. This control is often used to generate controls by code and to display or hide groups of controls as per the condition. The Panel control is used as a container for other controls.

What is panel control explain with its properties and events?

Advertisements. The Panel control works as a container for other controls on the page. It controls the appearance and visibility of the controls it contains. It also allows generating controls programmatically. The basic syntax of panel control is as follows: <asp:Panel ID= "Panel1" runat = "server"> </asp:Panel>


1 Answers

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.

like image 52
balexandre Avatar answered Oct 07 '22 08:10

balexandre