HtmlContainerControl Class
Assembly: System.Web (in system.web.dll)
The most common controls with a closing tag are the <form>, <table>, <tr>, <td>, <a>, and <span> elements.
The InnerText and InnerHtml properties allow you to manipulate the content between the opening and closing tags of HtmlContainerControl-derived controls.
For a list of initial property values for an instance of HtmlContainerControl, see the HtmlContainerControl constructor.
A new instance of this class is not created directly.
Caution |
|---|
| If you use the InnerHtml property to specify the text between the opening and closing tags of an HTML server control, the text is not HTML encoded. This makes it possible to embed script within HTML tags in the text. When using the InnerHtml property, be sure to validate the value to reduce security vulnerabilities. Otherwise, consider using the InnerText property instead. |
The following code example demonstrates how to use the InnerHtml property of this class to dynamically generate a message on a Web page.
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Message.InnerHtml = Server.HtmlEncode("Welcome! You accessed this page at: " & DateTime.Now) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>HtmlContainerControl Example</title> </head> <body> <form id="form1" runat="server"> <div> <span id="Message" runat=server></span> </div> </form> </body> </html>
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Web.UI.Control
System.Web.UI.HtmlControls.HtmlControl
System.Web.UI.HtmlControls.HtmlContainerControl
Derived Classes
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Caution