HtmlContainerControl Class
Defines the methods, properties, and events available to all HTML server controls that must have a closing tag.
For a list of all members of this type, see HtmlContainerControl Members.
System.Object
System.Web.UI.Control
System.Web.UI.HtmlControls.HtmlControl
System.Web.UI.HtmlControls.HtmlContainerControl
Derived classes
[Visual Basic] MustInherit Public Class HtmlContainerControl Inherits HtmlControl [C#] public abstract class HtmlContainerControl : HtmlControl [C++] public __gc __abstract class HtmlContainerControl : public HtmlControl [JScript] public abstract class HtmlContainerControl extends HtmlControl
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks
The most common controls with a closing tag are the <form>, <table>, <tr>, <td>, <a>, and <span> elements.
This class allows developers to manipulate the contents between the opening and closing tags of HTML server controls that inherit from this class.
For a list of initial property values for an instance of HtmlContainerControl, see the HtmlContainerControl constructor.
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.
Example
[Visual Basic, C#, JScript] The following example demonstrates how to use the InnerHtml property of this class to dynamically generate a message on a Web page.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <script language="VB" runat=server> Sub Page_Load(Src As Object, E As EventArgs) Message.InnerHtml = "Welcome! You accessed this page at: " & DateTime.Now End Sub 'Page_Load </script> <body> <span id="Message" runat=server></span> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <script language="C#" runat=server> void Page_Load(Object Src, EventArgs E) { Message.InnerHtml = "Welcome! You accessed this page at: " + DateTime.Now; } </script> <body> <span id="Message" runat=server></span> </body> </html> [JScript] <%@ Page Language="JScript" AutoEventWireup="True" %> <html> <script language="jscript" runat=server> function Page_Load(Src: Object, E: EventArgs){ Message.InnerHtml = "Welcome! You accessed this page at: " + DateTime.Now } </script> <body> <span id="Message" runat=server></span> </body> </html>
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Namespace: System.Web.UI.HtmlControls
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System.Web (in System.Web.dll)
See Also
HtmlContainerControl Members | System.Web.UI.HtmlControls Namespace | HtmlControl