
HtmlControl | 719
HtmlControls
Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
HtmlContainerControl
System.Web.UI.HtmlControls (system.web.dll)
disposable
abstract class
This abstract class provides functionality for all HTML server controls that require
closing tags. For example, an HtmlAnchor control must always be closed (<a>Text</a> and
<a/> are valid anchor tags, but <a> alone is not). An HtmlImage control, on the other
hand, does not need a closing tag.
Every control that requires a closing tag has the ability to contain text. This informa-
tion is provided through the InnerText and InnerHtml properties. Both properties retrieve all
the content between the opening and closing control tag. The difference is that InnerText
automatically encodes and decodes special characters into their corresponding HTML
entities. For example, if you set the InnerText property to <b>Hello</b>, the < and >
symbols are converted to the HTML equivalents < and >. This instructs the
browser to display <b>Hello</b> as plain text. However, if you set the InnerHtml property
to <b>Hello</b>, the < and > symbols will be interpreted as HTML markup tags and the
word “Hello” will be displayed in bold.
Hierarchy
System.Object ➝ System.Web.UI.Control(System.ComponentModel.IComponent, System.
IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) ...