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, HTML decodes the title. If the Text property of the Literal control is assigned, the value is HTML 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 HTML 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