Name

Load

Synopsis

Sub Page_Load(Sender As Object, e As EventArgs)
   ‘code
End Sub

Fired when the page is loaded. Since this event is fired on every page request, we can add any initialization code that needs to be executed at the page level, including the initialization of the page’s child controls. When the Load event fires, the page’s view state information is also accessible.

The Load event is passed the following arguments by ASP.NET:

Sender

An argument containing information about the object that raised the event.

e

An object of type EventArgs containing additional information about the event.

Example

See the example for Init.

Notes

Note that the Sender and e arguments are optional for this event, as shown in the example.

When the AutoEventWireup attribute of the @ Page directive is set to True (the default), ASP.NET will automatically call the event handler for this event, as long as it has the correct Page_Load event signature.

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.