Hi there I followed theis article on how to use web.config to change the directory locations but I get the following script load error:
---------------------------Error---------------------------A Runtime Error has occurred.Do you wish to Debug?Line: 3311Error: Sys.ScriptLoadFailedException: The script 'JS/NetAdvantage/20081CLR20/Scripts/ig_shared.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().---------------------------Yes No ---------------------------
in my web.config I've got the following entries:
<section name="infragistics.web" type="System.Configuration.SingleTagSectionHandler,System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
...
<infragistics.web imageDirectory="JS/NetAdvantage/images" javaScriptDirectory="JS/NetAdvantage/20081CLR20/Scripts" cssDirectory="JS/NetAdvantage/20081CLR20/Styles" formsDirectory="JS/NetAdvantage/20081CLR20/Forms" />
Things to note:
And this is where I run out of ideas....
Any help greatly apreciated!
Thanks for the follow-up and for sharing your solution in forums. This will certainly be useful for other developers as well.
I investigated that further and found out something interesting in the ScriptManager docs, which might explain this.
One key difference exists in how the ScriptManager treats scripts retrieved from the filesystem compared with those embedded as a resource in a dll. When the path to a script is used, the ScriptManager provides a callback to the ScriptResource handler, which retrieves the contents. The script itself is not modified (no extra calls are injected). When a script is retrieved as an embedded resource, however, the ScriptManager injects the call to Sys.Application.notifyScriptLoaded for you automatically. This allows you to start using scripts that you already have with ASP.NET AJAX without having to rebuild the dlls.
ScriptResource
Sys.Application.notifyScriptLoaded
So, the way I see it, in the first case the scripts were used from the embedded resources (this is the default option) via WebResource.axd, and in this case ScriptManager automatically added notifyScriptLoaded for us, hence no problems in your scenario (making an initially invisible control visible with UpdatePanel). By default our controls use the javascript embedded in the assembly (not ig_common).
In the second case, no embedded resources are used and the problem you get is related to that.
I guess it is a rare case to not use default resources + the combination to show controls with ajax updates - hence we were not able to detect that so far. I guess, the solution here is to have the notfiyScriptLoaded() call in all cases in the files we ship originally. I will suggest that to the development team.
Hopefully this is not a major showstopper for you currently.
Hi Rumen,
Thank you for your suggestions, but I can't use absolute paths like "~/JS/NetAdvantage..." because the app is always going to be deployed in a virtual directory which name will vary so it has to be relative. That works for me anyway.
I have resolved my problem - it was a valid AJAX script exception. Here I'll add my two cents as they say:
REASON: This is to do with the fact that after partial page postbacks scrips load asynchronously and then we need to notify Sys.Application that the script has been loaded and parsed. (This relates only to the ASP.NET AJAX Toolkit framework)
SOLUTION: Adding the following script at the end of every Infragistics script file loaded on that page fixed my problem.
if(typeof(Sys) !== "undefined" && typeof(Sys.Application) !== "undefined") Sys.Application.notifyScriptLoaded();
if(typeof(Sys) !== "undefined" && typeof(Sys.Application) !== "undefined")
Sys.Application.notifyScriptLoaded();
QUESTION: What I still don't understand is why this problem started after I changed the script location from the default "ig_common" virtual directory to the custom one specified in web.config ??? Anyone who knows the reason for this?
Hello Emil,
Thanks for writing and for the detailed information you have given. I am currently trying to reproduce the problem (I assume the grid is initially invisible and then it gets visible in a certain situation. The grid is placed inside the ContentTemplate of an asp:UpdatePanel).
While I still have not been able to reproduce that (I keep trying), I do have one suggestion. Is it possible, that the ASPX page hosting the grid (or the user-control / master-page, etc) is not directly in the root of the application? In this case the javaScriptDirectory setting will be relative to the ASPX page and not relative to the root, hence the possible failure to load the scripts (if JS is directly in the root)
Maybe you can try the tilde slash syntax "~/JS/NetAdvantage..." to specify the locations? Will this help?
Meanwhile I keep trying to reproduce the issue, so I can figure out what is going on.
Please, let me know if this helps.