Loading custom JavaScript files through the ScriptManager
This is an important change from beta1. In the new beta2 release, scripts added through the ScriptManager using ScriptReference controls are loaded asynchronously by a script loader (Sys.ScriptLoader).
For this reason, every JavaScript file referenced using a ScriptReference control must contain a call, at the end of the file, that notifies Sys.Application when the script is loaded. The statement to add at the end of the JavaScript file is the following:
| if(Sys && Sys.Application) { |
| Sys.Application.notifyScriptLoaded(); |
| } |
If you omit the call to notifyScriptLoaded(), you may get a Sys.ScriptLoadFailedException.
As a consequence, all the JavaScript files that don't contain the above statement must be referenced outside the ScriptManager control.
Check also this blog entry by Luis Abreu for some details on this change.