interviews.dotnetthread.com

↑ Grab this Headline Animator

Friday, July 17, 2009

Fix: Cutom Javascript Does not load in case of Partial Postback using UpdatePanel.

When we are using Update Panel for asynchronous Partial page postback static javasctipt files will not be loaded and we may see error like "Permission Denied" or something like

Error: Sys.ScriptLoadFailedException: The script 'http://localhost/Js/FreeTextBox/FTB-ToolbarItems.js' failed to load. Check for:
Inaccessible path.
Script errors. (IE) Enable 'Display a notification about every script error' under advanced settings.
Missing call to Sys.Application.notifyScriptLoaded().


This scenario occurs like when we are using a cutom Text Editor inside a UpdatePanel which uses Javascript and loads javascript files.

In order to fix this issue.
We need to call Sys.Application.notifyScriptLoaded() once the file is loaded for that
Just we need to add below code at the last line of all such javascript files


if (typeof(Sys) != "undefined") { if (typeof(Sys.Application) != "undefined") { Sys.Application.notifyScriptLoaded(); }}


Happy Coding....

Submit this story to DotNetKicks

1 comment:

Hapi said...

hello... hapi blogging... have a nice day! just visiting here....

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles