This documentation is archived and is not being maintained.
HtmlGenericControl Constructor
.NET Framework 1.1
Initializes a new instance of the HtmlGenericControl class.
Overload List
Initializes a new instance of the HtmlGenericControl class with default values.
[Visual Basic] Public Sub New()
[C#] public HtmlGenericControl();
[C++] public: HtmlGenericControl();
[JScript] public function HtmlGenericControl();
Initializes a new instance of the HtmlGenericControl class with the specified tag.
[Visual Basic] Public Sub New(String)
[C#] public HtmlGenericControl(string);
[C++] public: HtmlGenericControl(String*);
[JScript] public function HtmlGenericControl(String);
Example
[Visual Basic, C#] The following example demonstrates how to create a new instance of the HtmlGenericControl class using the overloaded constructor.
[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of the HtmlGenericControl constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Page_Load(sender as Object, e As EventArgs) ' Create a new HtmlGenericControl. Dim NewControl As New HtmlGenericControl("div") ' Set the properties of the new HtmlGenericControl control. NewControl.ID = "NewControl" NewControl.InnerHtml = "This is a dynamically created HTML server control." ' Add the new HtmlGenericControl to the Controls collection of the ' PlaceHolder control. ControlContainer.Controls.Add(NewControl) End Sub </script> </head> <body> <form runat="server"> <h3> HtmlGenericControl Constructor Example </h3> <asp:PlaceHolder ID="ControlContainer" runat="server"/> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Create a new HtmlGenericControl. HtmlGenericControl NewControl = new HtmlGenericControl("div"); // Set the properties of the new HtmlGenericControl control. NewControl.ID = "NewControl"; NewControl.InnerHtml = "This is a dynamically created HTML server control."; // Add the new HtmlGenericControl to the Controls collection of the // PlaceHolder control. ControlContainer.Controls.Add(NewControl); } </script> </head> <body> <form runat="server"> <h3> HtmlGenericControl Constructor Example </h3> <asp:PlaceHolder ID="ControlContainer" runat="server"/> </form> </body> </html>
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
See Also
HtmlGenericControl Class | HtmlGenericControl Members | System.Web.UI.HtmlControls Namespace
Show: