LiteralControl.Text Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the text content of the LiteralControl object.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public virtual string Text { get; set; }

Property Value

Type: System.String

A System.String that represents the text content of the literal control. The default is String.Empty.

The following code example creates a class, CustLiteralControlClass, that extends the LiteralControl class. It creates an instance of the class named myLiteralControlClass1 by using the constructor that does not specify the text of the LiteralControl object. After the object is created, the Text property is used to set the text that it contains.

CustomLiteralControlClass myLiteralControlClass1= 
               new CustomLiteralControlClass();
myLiteralControlClass1.Text="This Control demonstrates the constructor1";

.NET Framework
Available since 1.1
Return to top