This documentation is archived and is not being maintained.

LiteralControl Constructor

.NET Framework 1.1

Initializes a new instance of the LiteralControl class.

Overload List

Initializes a new instance of the LiteralControl class that contains a literal string to be rendered on the requested ASP.NET page.

[Visual Basic] Public Sub New()
[C#] public LiteralControl();
[C++] public: LiteralControl();
[JScript] public function LiteralControl();

Initializes a new instance of the LiteralControl class with the specified text.

[Visual Basic] Public Sub New(String)
[C#] public LiteralControl(string);
[C++] public: LiteralControl(String*);
[JScript] public function LiteralControl(String);

Example

[Visual Basic] 
' Add two LiteralControls that render HTML H3 elements and text.
<System.Security.Permissions.PermissionSetAttribute(System.Security.Permissions.SecurityAction.Demand, Name:="FullTrust")> _
Protected Overrides Sub CreateChildControls()

    Me.Controls.Add(New LiteralControl("<h3>Value: "))

    Dim Box As New TextBox
    Box.Text = "0"
    Me.Controls.Add(box)

    Me.Controls.Add(New LiteralControl("</h3>"))
End Sub

[C#] 
// Add two LiteralControls that render HTML H3 elements and text.
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] 
protected override void CreateChildControls() {

    this.Controls.Add(new LiteralControl("<h3>Value: "));

    TextBox box = new TextBox();
    box.Text = "0";
    this.Controls.Add(box);

    this.Controls.Add(new LiteralControl("</h3>"));
}

[C++] 
// Add two LiteralControls that render HTML H3 elements and text.
protected:
[System::Security::Permissions::PermissionSet(System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] 
void CreateChildControls() 
{
   this->Controls->Add(new LiteralControl(S"<h3>Value: "));

   TextBox* box = new TextBox();
   box->Text = S"0";
   this->Controls->Add(box);

   this->Controls->Add(new LiteralControl(S"</h3>"));
}

[JScript] 

See Also

LiteralControl Class | LiteralControl Members | System.Web.UI Namespace

Show: