Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
LoadControl Method (Type, Object[])
Collapse the table of content
Expand the table of content

TemplateControl.LoadControl Method (Type, Object[])

Loads a Control object based on a specified type and constructor parameters.

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

public Control LoadControl (
	Type t,
	Object[] parameters
)
public Control LoadControl (
	Type t, 
	Object[] parameters
)
public function LoadControl (
	t : Type, 
	parameters : Object[]
) : Control
Not applicable.

Parameters

t

The type of the control.

parameters

An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If parameters is an empty array or a null reference (Nothing in Visual Basic), the constructor that takes no parameters (the default constructor) is invoked.

Return Value

Returns the specified UserControl.

If the user control supports caching, the object returned from the LoadControl method is not actually a UserControl object; rather, it is a PartialCachingControl object.

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.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2015 Microsoft