Literal Web Server Control

Displays static contents on the page and allows you to manipulate it programmatically.

<asp:Literal id="Literal1"


Use the Literal control to display static text on the Web Forms page. Unlike the Label control, Literal does not let you apply styles to its content.

Note   Text is not HTML encoded before it is displayed in the Literal control. This makes it possible to embed script within HTML tags in the text. If the values for the control come from user input, be sure to validate the values to help prevent security vulnerabilities.


The following example demonstrates how to use the Literal control to display static text.

   <form runat="server">
      <h3>Literal Example</h3>
      <asp:Literal id="Literal1"
           Text="Hello World!!"

See Also

Web Server Controls | Literal Class