More About Server Controls

ASP.NET provides two sets of server controls: web controls and HTML controls. Web controls (defined in the System.Web.UI.WebControls namespace) are similar to controls found in standard desktop applications. They shield the developer as much as possible from representing the controls in HTML. In other words, web controls are as similar as possible to desktop-application controls, leaving it up to each control to worry about how it will represent itself in HTML. This lets the developer design a UI without worrying much about the limitations of HTML. The controls presented thus far are web controls.

In contrast, HTML controls (defined in the System.Web.UI.HtmlControls namespace) are a thin wrapper over HTML client controls defined in the HTML standard. HTML server controls let the developer omit specific HTML client controls, while retaining the programmatic capabilities that server controls provide. Web page developers are likely to use HTML server controls only when they want to generate and manipulate specific HTML client controls with server-side technology. Microsoft makes no statement about which set of server controls is “better” to use. They present both, leaving it to the developer to decide which controls fit better into a given application.

Web Controls

The web controls can be created using HTML syntax as well as programmatically. When you create a control using HTML syntax, the control’s tag name consists of the prefix asp: followed by the name ...

Get Programming Visual Basic .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.