Export (0) Print
Expand All

Control.Load Event

Occurs when the server control is loaded into the Page object.

[Visual Basic]
Public Event Load As EventHandler
[C#]
public event EventHandler Load;
[C++]
public: __event EventHandler* Load;

[JScript] In JScript, you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives an argument of type EventArgs.

Remarks

Notifies the server control to perform any processing steps that are set to occur on each page request. You can acess view state information and form POST data from this event. You can also access other server controls within the page's control hierarchy.

Example

[Visual Basic] 
' This is the constructor for a custom Page class. 
' When this constructor is called, it associates the Control.Load event,
' which the Page class inherits from the Control class, with the Page_Load
' event handler for this version of the page.
Public Sub New()
   AddHandler Load, AddressOf Page_Load
End Sub 'New


[C#] 
// This is the constructor for a custom Page class. 
// When this constructor is called, it associates the Control.Load event,
// which the Page class inherits from the Control class, with the Page_Load
// event handler for this version of the page.
public MyPage()
{
   Load += new EventHandler(Page_Load);
}

[C++] 
// This is the constructor for a custom Page class. 
// When this constructor is called, it associates the Control.Load event,
// which the Page class inherits from the Control class, with the Page_Load
// event handler for this version of the page.
public:
MyPage()
{
   ctlOne = new MyControl();
   Load += new EventHandler(this, &MyPage::Page_Load);
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, 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

Control Class | Control Members | System.Web.UI Namespace | Control Execution Lifecycle | Web Forms Page Processing

Show:
© 2014 Microsoft