System.Web.UI.WebControls.Literal Class

Reserves a location on the Web page to display static text.

See Also: Literal Members

Syntax

[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.LiteralDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.IDesigner")]
[System.ComponentModel.DefaultProperty("Text")]
[System.Web.UI.DataBindingHandler("System.Web.UI.Design.TextDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.LiteralControlBuilder))]
public class Literal : System.Web.UI.Control, System.Web.UI.ITextControl

Remarks

In this topic:

Introduction

Use the System.Web.UI.WebControls.Literal control to reserve a location on the Web page to display text. The System.Web.UI.WebControls.Literal control is similar to the System.Web.UI.WebControls.Label control, except the System.Web.UI.WebControls.Literal control does not allow you to apply a style to the displayed text. You can programmatically control the text displayed in the control by setting the Literal.Text property.

Note:

This control can be used to display user input, which might include malicious client script. Check any information that is sent from a client for executable script, SQL statements, or other code before displaying it in your application. ASP.NET provides an input request validation feature to block script and HTML in user input. Validation server controls are also provided to assess user input.

For more information about security, see Securing Standard Controls, How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings, and Introduction to Validating User Input in ASP.NET Web Pages.

Declarative Syntax

Example

<asp:Literal
    EnableTheming="

Requirements

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0