Literal control

You can use a Literal control as a container for other content on the page. The Literal control is used most frequently when adding content dynamically to the page.

  1. Drag the Literal control from the Toolbox panel to your page.

  2. Set properties for the control in the Tag Properties panel.

Common Literal Properties




Specifies the text displayed in the Literal control. In the user's browser, this is rendered as HTML.


Specifies how the control handles markup that you add to it. For details, see Literal Web Server Control Overview in the MSDN library.

For a full description of all Literal control properties, see Literal Properties in the MSDN library.

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 allows you to specify whether content is encoded.

The Panel and Placeholder controls render as DIV elements, which create discrete blocks in the page, unlike rendering in-line the way the Label and Literal controls do.

In general, use a Literal control when you want to render text and controls directly into a page without any additional markup.

Community Additions