Provides a run-time object that exposes client events and manages client components that are registered with the application. The members of this object are available globally after the client application has been initialized. The members can be invoked without creating an instance of the class.
Raised after all scripts have been loaded but before objects are created.
Raised after all scripts have been loaded and after the objects in the application have been created and initialized.
Occurs when the user clicks the browser's Back or Forward button.
Raised before all objects in the client application are disposed.
Registers a component with the application and initializes it if the component is not already initialized.
Creates a history point and adds it to the browser's history stack.
Instructs the application to start creating components.
Called by the Sys.Application.beginUpdate method to indicate that the process of setting component properties of the application has begun.
Releases resources and dependencies held by the client application.
Instructs the application to finalize component creation.
Called by the Sys.Application.endCreateComponents method to indicate that the process of updating the application has completed.
Returns the specified Sys.Component object.
Provides a shortcut to the findComponent method.
Returns an array of all components that have been registered with the application through the addComponent method.
Initializes the application and raises the load event.
Called by a referenced script to indicate that the script has been loaded.
Sequentially queues the scripts to be loaded in the queued order.
Raises the load event.
Raises the Sys.INotifyPropertyChange.propertyChanged event.
Registers an object that will require disposing with the application.
Removes the object from the application and disposes the object if it is disposable.
Unregisters a disposable object from the application.
Called by the Sys.Application.endUpdate method as a placeholder for additional logic.
Gets or sets a value that indicates whether the Web application supports history point management.
Gets a value that indicates whether the application is in the process of creating components.
The Application object provides functions and events that support client-component development. The Application object is a single instance of the private Sys._Application class. The Application object is created when an ASP.NET AJAX page is viewed in the browser and persists for the life of the page. The Application object is responsible for raising client page life-cycle events such as pageInit, pageLoad, and pageUnload, and for managing the disposal of registered components.
The Application object provides the init, load, and unload events, and it inherits the disposing and propertyChanged events from the base Component class. All of these events apply to the life cycle of the client application in the browser.
If partial-page rendering is supported and the page contains an UpdatePanel control, the PageRequestManager class provides additional events that apply to the parts of the page that are rendered asynchronously. For more information about partial-page rendering, see Partial-Page Rendering Overview.
Individual components can expose events that apply only to the component. They can also access application-level events by using the Application object.
In most cases, page developers should put their code in the load event. At that point in the page life cycle, all scripts are loaded and all components have been created and ready to use. Any code that is included in a function named pageLoad will automatically run when the page loads.
Component developers can access other events or bind additional handlers to the load or unload events by invoking the event's add_ accessor method and passing the handler function. The following example shows how to bind a function named myUnloadHandler to the unload event.
When an event and its handlers are no longer needed, you can call the remove_ accessor method, as in the following example:
You can attach additional handlers to an event by calling the add_ accessor one time for each handler. Handlers are removed individually by calling the remove_ accessor method.
For more information about the Sys.Application events, see AJAX Client Life-Cycle Events.
In most scenarios, you should add components to an application by using the $create command. After a component has been registered with the application, you can access it in the application by calling the findComponent method or the $find shortcut. You can get a list of all available components by calling the getComponents method.
For more information about how to develop components, controls, and behaviors, see Adding AJAX Functionality to ASP.NET Controls.
Referencing Script Files
If you reference a standalone script file (.js file) for use with partial-page rendering, the code in the script file must call the notifyScriptLoaded method. This notifies the application that the script has finished loading. For more information, see Sys.Application.notifyScriptLoaded Method.