Represents HTML elements, text, and any other strings in an ASP.NET page that do not require processing on the server.
See Also: LiteralControl Members
ASP.NET compiles all HTML elements and readable text that do not require server-side processing into instances of this class. For example, an HTML element that does not contain a runat="server" attribute/value pair in its opening tag is compiled into a System.Web.UI.LiteralControl object. System.Web.UI.LiteralControl objects do not maintain view state, so the contents of a System.Web.UI.LiteralControl object must be recreated on each request.
Literal controls behave as text holders, meaning that you can extract text from the literal control and remove the literal control from the parent server control's System.Web.UI.ControlCollection collection through the parent's Control.Controls property. Therefore, when you develop a custom control derived from the System.Web.UI.LiteralControl class, make sure your control performs any required preprocessing steps itself, rather than using a call to the LiteralControl.Render(HtmlTextWriter) method to accomplish them. Typically, you would do this to improve the response time of your Web application.
You can add or remove literal controls from a page or server control programmatically using the ControlCollection.Add(Control) or the ControlCollection.Remove(Control) method, respectively.