Latest web development tutorials

ASP.NET Literal Controls

Web Server Controls Web server control

Definition and Usage

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!


Attributes

属性 描述 .NET
Mode 2.0
runat 规定该控件是服务器控件。必须设置为 "server"。 1.0
Text 规定要显示的文本。 1.0

Control Standard Properties

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

For a full description, go to Control Standard Attributes .


Examples

Literal
In this example, we declare a static text display Literal control 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. This subroutine will change the text Literal control.


Web Server Controls Web server control