Assembly: System.Web.Extensions (in System.Web.Extensions.dll)
Use the method to register dispose scripts for controls that are inside an UpdatePanel control. During asynchronous postbacks, UpdatePanel controls can be updated, deleted, or created. When a panel is updated or deleted, any dispose scripts that are registered for controls that are inside the UpdatePanel are called. In typical page development scenarios, you do not have to call the method.
The method is intended for use by control developers to register script or create controls that inherit from the IScriptControl interface. For example, you might use a dispose script if you develop a client control by using composition. In your control, you implement IScriptControl and render individual controls. You register the dispose method of any item that does not correspond to a defined client component such as Sys.TextBox. If your custom control composes elements that correspond to client components in the Microsoft Ajax Library, you do not have to register a dispose script, because dispose is called automatically. Therefore, use the method for client components that are part of the Microsoft Ajax Library and that have to free resources when a component is no longer used.
The method can be called multiple times for a control. Multiple scripts are aggregated. The order of disposing scripts matches the order in which the scripts were registered.
If you register a dispose script for a control that is not in an UpdatePanel control, an exception is thrown. The dispose script is called between the pageLoading and pageLoaded events of the PageRequestManager class.