Both are ASP.NET server controls. The ones corresponding to HTML elements are in the System.Web.UI.HtmlControls
namespace, and the web controls are in the System.Web.UI.WebControls
namespace.
The HTML controls are more light-weight and correspond exactly to an HTML element, while the web controls have more features and can be rendered as different HTML elements depending on the browser capabilities and the settings of the control.
A HTML control renders as a single HTML element, while a web control is rendered as zero or more HTML elements. The Literal
control for example isn't rendered as an element, it only outputs its text. There are other controls that doesn't render any elements by themselves, like the Repeater
and PlaceHolder
controls. On the other hand, the CheckBoxList
control for example is rendered as several HTML element, a table
as container, and input
elements for each checkbox inside it.
An example of a control that is rendered using different elements is the TextBox
control, which will be rendered either as an input
or a textarea
element depending on its TextMode
property.
The web controls have more features, but also uses more resources. They have more properties and support things like themes and data binding. Many of the web controls put data in the ViewState
, which is sent as part of the page. If you are not careful, the ViewState
can get quite large, and affect the loading time of the page.