System.Web.UI.HtmlControls.HtmlContainerControl.InnerText Property

Gets or sets the text between the opening and closing tags of the specified HTML server control.

Syntax

[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
[System.ComponentModel.Browsable(false)]
public virtual string InnerText { set; get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the HtmlContainerControl.InnerText property to programmatically modify the text between the opening and closing tags of an HTML server control.

Unlike the HtmlContainerControl.InnerHtml property, the HtmlContainerControl.InnerText property automatically encodes special characters to and from HTML entities. HTML entities allow you to display special characters, such as the < character, that a browser would ordinarily interpret as having special meaning. The < character would be interpreted as the start of a tag and is not displayed on the page. To display the < character, you would need to use the entity &lt;.

For example, if the HtmlContainerControl.InnerText property is set to "<b> Hello </b>", the < and > symbols are converted to &lt; and &gt;, respectively. The rendered output would be: &lt; b &gt; Hello &lt; /b &gt;. The &lt; and &gt; entities would indicate to the browser that these characters are to be displayed on the page. The browser will not detect the <b> tags and display the text in a bold font. The text displayed on the page is: <b> Hello </b>.

To prevent automatic HTML encoding and decoding, use the HtmlContainerControl.InnerHtml property.

Note:

If there are no child controls, the HtmlContainerControl.InnerHtml property contains the value string.Empty.

Requirements

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0