ASP.NET Text property

Definition and usage

The Text property is used to set or return the text of the Literal control.

According to the assignment method of this property, decode the title with HTML. If the value is assigned through the Text property of the Literal control, the value is decoded before display. For example, <asp:Literal id="DisplayLiteral" Text="A B"/> is displayed as "A B" in the browser. However, if assigned programmatically, or by placing the text between the start and end tags of the control, the title is not decoded. For example, <asp:Literal id="DisplayLiteral"> A B </asp:Literal> is displayed as "A B".

Syntax

<asp:HyperLink Text="string" runat="server" />
Property Description
string String value, specifies the text in the literal control.

Example

The following example sets the text for the Literal control:

<form runat="server">
<asp:Literal runat="server" Text="W3School" />
</form>

Example

Set text for Literal control