Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [128]

By Root 5355 0
HtmlControl class, a container control features a couple of additional string properties: InnerHtml and InnerText.

Both properties manipulate the reading and writing of literal content found between the opening and closing tags of the element. Note that you cannot get the inner content of a control if the content includes server controls. InnerHtml and InnerText work only in the presence of all literal content. The tag itself is not considered for the output. Unlike InnerText, though, InnerHtml lets you work with HTML rich text and doesn’t automatically encode and decode text. In other words, InnerText retrieves and sets the content of the tag as plain text, whereas InnerHtml retrieves and sets the same content but in HTML format.

Table 6-7 lists the HTML container controls defined in ASP.NET.

Table 6-7. HTML Container Controls

Class

Description

HtmlAnchor

Represents an HTML anchor—specifically, the < a> tag.

HtmlButton

Represents the HTML < button> tag.

HtmlForm

Represents the < form> tag, but can be used only as a container of interactive server controls on a Web page. It cannot really be used to create HTML forms that are programmable on the server.

HtmlGenericControl

Represents an HTML tag for which the .NET Framework does not provide a direct class. Sample tags include < font>,


, and