Gets or sets all text between the opening and closing tags of the specified HTML server control.
[Visual Basic] Overridable Public Property InnerText As String [C#] public string InnerText {virtual get; virtual set;} [C++] public: __property virtual String* get_InnerText(); public: __property virtual void set_InnerText(String*); [JScript] public function get InnerText() : String; public function set InnerText(String);
The text between opening and closing tags of an HTML server control.
Exception Type | Condition |
---|---|
HttpException | There is no HTML Server control to get the content from.
-or- There is more than one HTML Server control. -or- The HTML Server control is not a literal control. |
Unlike the InnerHtml property, InnerText provides automatic HTML encoding and decoding.
This example demonstrates the HTML encoding service available through this property.
[C#]
<html> <script language="C#" runat=server> void Page_Load(Object Src, EventArgs E) { Message.InnerText = "<b>Welcome!</b>" ; } </script> <body> <font id="MessageFont" size="14" runat=server> <span id="Message" runat=server></span> </font> </body> </html>
HtmlContainerControl Class | HtmlContainerControl Members | System.Web.UI.HtmlControls Namespace