Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

TemplateControl.LoadControl Method

Loads a Control.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  Name Description
Public method LoadControl(String) Loads a Control object from a file based on a specified virtual path.
Public method LoadControl(Type, Object[]) Loads a Control object based on a specified type and constructor parameters.
Top

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.

Topic Location
How to: Create Instances of ASP.NET User Controls Programmatically Building ASP .NET Web Applications
How to: Create Instances of ASP.NET User Controls Programmatically Building ASP .NET Web Applications
Show:
© 2015 Microsoft