ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 539
نمايش فراداده

HtmlContainerControldisposable

System.Web.UI.HtmlControls (system.web.dll)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 information 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 &lt; and &gt;. 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.

public abstract class 

HtmlContainerControl : HtmlControl { // Public Constructors public

HtmlContainerControl ( ); public

HtmlContainerControl (string

tag ); // Public Instance Properties public virtual string

InnerHtml {set; get; } public virtual string

InnerText {set; get; } // Protected Instance Methods protected override ControlCollection

CreateControlCollection ( ); // overrides HtmlControl protected override void

LoadViewState (object

savedState ); // overrides System.Web.UI.Control protected override void

Render (System.Web.UI.HtmlTextWriter

writer ); // overrides HtmlControl protected override void

RenderAttributes (System.Web.UI.HtmlTextWriter

writer ); // overrides HtmlControl protected virtual void

RenderEndTag (System.Web.UI.HtmlTextWriter

writer ); }

Hierarchy

System.Object System.Web.UI.Control(System.ComponentModel.IComponent, System.IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor) HtmlControl(System.Web.UI.IAttributeAccessor) HtmlContainerControl

Subclasses

HtmlAnchor, HtmlButton, HtmlForm, HtmlGenericControl, HtmlSelect, HtmlTable, HtmlTableCell, HtmlTableRow, HtmlTextArea