ASP.NET Literal Control
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. It must be set to "server". | 1.0 |
Text | Specifies the text to be displayed. | 1.0 |
Web Control Standard Attributes
AccessKey, Attributes, BackColor, BorderColor, BorderStyle, BorderWidth CssClass, Enabled, Font, EnableTheming, ForeColor, Height, IsEnabled SkinID, Style, TabIndex, ToolTip, Width
For a complete description, please visit Web Control Standard Attributes.
Control Standard Attributes
AppRelativeTemplateSourceDirectory, BindingContainer, ClientID, Controls EnableTheming, EnableViewState, ID, NamingContainer, Page, Parent, Site TemplateControl, TemplateSourceDirectory, UniqueID, Visible
For a complete description, please visitControl Standard Attributes.
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.