System.Web 1.0.5000.0 2.0.0.0 Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details. System.Web.UI.Control System.Web.UI.ITextControl 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))

In this topic:

Introduction

Declarative Syntax

## Introduction

Use the control to reserve a location on the Web page to display text. The control is similar to the control, except the 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 property.

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

`<asp:Literal EnableTheming="True|False" EnableViewState="True|False" ID="string" Mode="Transform|PassThrough|Encode" OnDataBinding="DataBinding event handler" OnDisposed="Disposed event handler" OnInit="Init event handler" OnLoad="Load event handler" OnPreRender="PreRender event handler" OnUnload="Unload event handler" runat="server" SkinID="string" Text="string" Visible="True|False" />`

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

- Constructor
  To be added

  Initializes a new instance of the class.

  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` a To be added

  Notifies the control that an XML or HTML element was parsed and adds that element to the of the control.

  1.0.5000.0
  2.0.0.0
- Method
  System.Web.UI.ControlCollection a To be added

  Creates an object for the current instance of the control.

  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)
  System.Void

  The control overrides the method of the base class. The method of a control always throws an exception to indicate that the method is not supported on a control.

  Set input focus to a control; the base control method is not supported on a control.

- Property
  2.0.0.0
  System.ComponentModel.DefaultValue(System.Web.UI.WebControls.LiteralMode.Transform)
  System.Web.UI.WebControls.LiteralMode To be added.

  Use the property to specify how the contents of a control should be rendered. This property is set using one of the enumeration values. The following table lists the possible values.

  Value

  Description

  PassThrough

  The contents of the control are not modified.

  Encode

  The contents of the control are converted to an HTML-encoded string.

  Transform

  Unsupported markup-language elements are removed from the contents of the control. If the control is rendered on a browser that supports HTML or XHTML, the control's contents are not modified.

  If you specify PassThrough, the entire contents of the property are passed to the device or browser without making any modifications. For example, if the property of a control contains an <hr> tag, it is sent to all devices and browsers whether it is supported or not.

  If you specify Encode, the contents for the property are converted into an HTML-encoded string before rendering. For example, if the property of a control contains an <hr> tag, it is converted to &lt;Hr&gt; and sent to the device or browser.

  If you specify Transform, the rendering behavior of the property depends on the type of markup being rendered. When the control is rendered for a device or browser that supports HTML or XHTML, specifying produces the same behavior as specifying . All markup tags and elements for the property are rendered for the requesting browser.

  When the control is rendered for a markup language other than HTML or XHTML, such as WML or cHTML, you can use the value to remove unsupported markup elements. In this case, any markup language elements of the property that are not supported in the targeted markup language are not rendered for the control. For example, if the property of a control contains an <hr> tag, the tag is removed before the content is sent to a WML device. If an unsupported tag contains content, only the tag is removed and the content is sent to the device or browser. For example, if the property contains the content <XYZ>Test</XYZ>, the <XYZ> and </XYZ> tags are removed, and the text "Test" is sent to the device or browser.

  Gets or sets an enumeration value that specifies how the content in the control is rendered.

- Method
  System.Void `` a To be added

  Sends server control content to a provided object, which writes the content to be rendered on the client.

  1.0.5000.0
  2.0.0.0
- Property
  System.String To be added: an object of type 'string'

  Use the property to specify or determine the caption displayed in the control. This allows you to programmatically change the caption at run time.

  The caption is HTML-decoded depending on how you assign a value to this property. If you assign a value through an attribute of the control, the value is HTML decoded before it is displayed. For example, <asp:Literal id="DisplayLiteral" Text="A&nbsp;B"/> is rendered as "A B" on the browser. However, if you set this property programmatically or by placing the text between the opening and closing tags of the control, the caption is not HTML decoded. For example, <asp:Literal id="DisplayLiteral"> A&nbsp;B </asp:Literal> is rendered as "A&nbsp;B".

  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, see Validation Server Controls.

  The value of this property, when set, can be saved automatically to a resource file by using a designer tool. For more information, see and ASP.NET Globalization and Localization.

  Gets or sets the caption displayed in the control.

  1.0.5000.0
  2.0.0.0
  System.ComponentModel.Localizable(true)
  System.ComponentModel.DefaultValue("")
  System.ComponentModel.Bindable(true)