Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Sys.Application.load Event

Raised after all scripts have been loaded and the objects in the application have been created and initialized.

Syntax

Sys.Application.add_load(handler);
Sys.Application.remove_load(handler);

Arguments

handler

The delegate function to bind or unbind from the load event.

Remarks

Attach delegate functions to the load event to complete any tasks that must be performed after the objects have been created in the application and when they can reference each other. The add_load accessor binds a delegate function to the load event, and the remove_load accessor unbinds it. The load event occurs immediately before the pageLoad event. For more information, see ASP.NET AJAX Client Life-Cycle Events.

Example

The following example shows how to add a handler function to the load event. The event handler redirects the user to another page if the application is loaded outside business hours.

CS

// Attach a handler to the load event.
Sys.Application.add_load(applicationLoadHandler);

function applicationLoadHandler() {
    // Redirect to alternate page if not business hours.
    var d = new Date();
    if (!(8 < d.getHours() < 17)) {
        window.location = "AfterHours.aspx";
    }
}