ParseControl Method (String)
Collapse the table of content
Expand the table of content

TemplateControl.ParseControl Method (String)


Parses an input string into a Control object on the Web Forms page or user control.

Namespace:   System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public Control ParseControl(
	string content


Type: System.String

A string that contains a user control.

Return Value

Type: System.Web.UI.Control

The parsed Control.

The content parameter contains a user control, such as you would find in an .ascx file. This string cannot contain any code, because the ParseControl method never causes compilation.

The following code example demonstrates how to create a Button Web server control using the ParseControl method, and then adds the result to the ControlCollection collection of a PlaceHolder Web server control named myPlaceholder.

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft