TemplateControl.LoadControl Method (String)
Loads a Control object from a file based on a specified virtual path.
Assembly: System.Web (in System.Web.dll)
If the control supports caching, the object returned from the Control object; rather, it is a PartialCachingControl object. If the virtualPath parameter is relative, the path of the loaded control is relative to the path of the TemplateControl.method is not actually a
When you load a control into a container control, the container raises all of the added control's events until it has caught up to the current event. However, the added control does not catch up with postback data processing. For an added control to participate in postback data processing, including validation, the control must be added in the Init event rather than in the Load event.
The following code example demonstrates how to use themethod to add a user control to an ASP.NET page.
For the definition of the MyControl class that is used in this code example, see TemplateControl.
Available since 1.1