Share via


HTML Div Control

The behavior of the Div control is based on the HTML div element. This control is available on the HTML tab of the Toolbox.

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.

HTML server controls added from the Toolbox to a page in Visual Studio are simply HTML elements with certain attributes already set. You can also create HTML elements in Source view by typing markup.

By default, HTML elements on a Web Forms page are not available to the server; they are treated as markup that is passed through to the browser. However, if you add an id attribute and the attribute runat="server", ASP.NET recognizes the element as a control on the page and you can program it with server-based code. If you convert an HTML DIV element to an ASP.NET server control, it is created as an instance of the HtmlGenericControl class. For more information, see ASP.NET Web Server Controls Overview. For a list of these controls, see HTML Server Controls.

ASP.NET server controls that render as a DIV element are as follows:

  • Panel

  • UpdatePanel

  • UpdateProgress

See Also

Tasks

How to: Convert HTML Server Controls to HTML Elements

Other Resources

Adding HTML Server Controls to an ASP.NET Web Page