ASP.NET Literal-Kontrolle

Definition und Verwendung

Der Literal-Bereich wird verwendet, um Text auf der Seite anzuzeigen. Dieser Text ist programmierbar.

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 Properties

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 Properties.

Control Standard Properties

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

For a complete description, please visitControl 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.