ASP.NET Literal Control
Web Server Controls
Definition and Usage
The Literal control is used to display text on the page. This text is programmable.
**Note:** This control does not allow you to apply styles to its content!
property
| property | Description | .NET |
|---|---|---|
| Mode | 2.0 | |
| runat | Specifies that the control is a server control. Must be set to "server". | 1.0 |
| Text | Specifies the text to display. | 1.0 |
Web Control Standard Properties
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visit Web Control Standard Properties。
Example
Literal
In this example, we declare a Literal control that displays static text in the .aspx file.
Literal 2
In this example, we declare a Literal control and a Button control in the .aspx file. When the user clicks the button, the submit subroutine is executed. This subroutine changes the text of the Literal control.
Web Server Controls