asp.net.ph

LiteralControl Class

System.Web.UI Namespace


Represents HTML elements, text, and any other strings in an ASP.NET page that do not require processing on the server.

LiteralControl Class Members

Collapse   Constructors

Visibility Constructor Parameters
public LiteralControl ( )
public LiteralControl ( String text )

Collapse   Properties

Visibility Name Value Type Accessibility
public Text String [ Get , Set ]

Collapse   Methods

Visibility Name Parameters Return Type
protected CreateControlCollection ( ) ControlCollection

Remarks

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 LiteralControl object.

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 ControlCollection through the parent's Controls property. Therefore, when you develop a custom control derived from the LiteralControl class, make sure your control performs any required preprocessing steps itself, rather than using a call to the LiteralControl.Render method call 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 or ControlCollection.Remove method, respectively.

See Also

DataBoundLiteralControl Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph