Literal Web Server Control Overview
You can use a Literal Web server control as a container for other content on the page.
This topic contains:
The Literal control represents one of several options for adding content to a page. For static content, you can add markup directly to a page as HTML, without using a container. However, if you want to add content dynamically, you must add the content to a container. Typical containers are the Label control, the Literal control, the Panel control, and the PlaceHolder control.
The Literal control differs from the Label control in that the Literal control does not add any HTML elements to the text. (The Label control renders a span element.) As a consequence, the Literal control does not support any style attributes, including position attributes. However, the Literal control enables you to specify whether content is encoded.
In general, use a Literal control when you want to render text and controls directly into a page without any additional markup.
Transform . Any markup that you add to the control is transformed to accommodate the protocol of the requesting browser. This setting is useful if you are rendering content to mobile devices that use protocol other than HTML.
PassThrough . Any markup that you add to the control is rendered as-is to the browser.
Encode . Any markup that you add to the control is encoded using the HtmlEncode method, which converts HTML encoding into its text representation. For example, a <b> tag is rendered as <b>. Encoding is useful when you want the browser to display markup rather than interpret it. Encoding is also useful for security, to help prevent malicious markup from being executed in the browser. It recommended if you are displaying strings from an untrusted source. For more information, see How to: Protect Against Script Exploits in a Web Application by Applying HTML Encoding to Strings.