Chapter 37. The System.Web.UI.HtmlControlsNamespace
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, automatic 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 properties. In addition, controls that require both an opening and closing
tag inherit from HtmlContainerControl. This class
adds a HtmlContainerControl.InnerText and HtmlContainerControl.InnerHtml property which allow you to access the text contained inside the tag. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access