This documentation is archived and is not being maintained.

UserControl.InitializeAsUserControl Method

Initializes the UserControl object that has been created declaratively. Since there are some differences between pages and user controls, this method makes sure that the user control is initialized properly.

[Visual Basic]
Public Sub InitializeAsUserControl( _
   ByVal page As Page _
)
[C#]
public void InitializeAsUserControl(
 Page page
);
[C++]
public: void InitializeAsUserControl(
 Page* page
);
[JScript]
public function InitializeAsUserControl(
   page : Page
);

Parameters

page
The Page object that contains the user control.

Example

[Visual Basic, C#] The following example calls the InitializeAsUserControl method during the Page_Init stage of request processing. In this case it is initialized from the page itself, but you could initialize it from another control and pass the ID property value of the containing page as the parameter for this method.

[Visual Basic] 
' Initialize the UserControl object that has been created declaratively. 
   myControl.InitializeAsUserControl(Me)

[C#] 
// Initialize the UserControl object that has been created declaratively. 
   myControl.InitializeAsUserControl(this);

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

UserControl Class | UserControl Members | System.Web.UI Namespace

Show: