
716
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Chapter 39HtmlControls Namespace
39
The System.Web.UI.
HtmlControls Namespace
The System.Web.UI.HtmlControls namespace includes classes for HTML server controls.
HTML server controls are ASP.NET controls that raise events on the server and
provide a simple object model that allows you to set some basic properties. Unlike
web controls, which are found in the System.Web.UI.WebControls namespace, each
HTML server control corresponds directly to an HTML element like <textarea> or
<input>. Web controls are generally preferred in ASP.NET development because
they are abstracted away from the low-level HTML details and they provide a
richer object model with many more events, sophisticated data binding, auto-
matic state management, and validation controls. HTML server controls are most
often used when upgrading existing ASP pages. A standard HTML element can be
converted into an HTML server control by adding the attribute runat="server" in the
tag. This makes it extremely simple to convert a static HTML page into a dynamic
page that allows controls to be manipulated as objects during postbacks.
All controls in this namespace derive from HtmlControl. This class provides basic
functionality, including a name/value collection of attributes and CSS style prop-
erties. In addition, controls that ...