ASP.NET LiteralControl


Web Server ControlsWeb Server Control

Definition and Usage

The Literal control is used to display text on a page. This text is programmable.

Note:This control does not allow you to apply styles to its content!


Properties

Property Description .NET
Mode 2.0
runat Specifies that this control is a server control. Must be set to "server". 1.0
Text Specifies the text to be displayed. 1.0

Control Standard Properties

AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls, EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site, TemplateControl, TemplateSourceDirectory, UniqueID, Visible

For a full description, please visitControl Standard Properties。


Example

Literal
In this example, we declare a Literal control that displays static text in an .aspx file.

Literal 2
In this example, we declare a Literal control and a Button control in an .aspx file. When the user clicks the button, the submit subroutine is executed. This subroutine changes the text of the Literal control.


Web Server ControlsWeb Server Control Other Extensions