I've just installed and created an animation using Beta 2.0.
The problems I'm experiencing are that I'm getting the following (javascript) errors.
'Sys.Application' is null or not an object
'Sys.UI.DomEvent' is null or not an object
'Sys.Res.argumentUndefined' is null or not an object
'Sys.Res.enumValueNotInteger' is null or not an object
After searching google and the forums I've tried numerous suggestions to no avail. I've managed to narrow the cause of the errors down to a specific place. I only receive the errors when I include a couple of javascript files that have nothing to do with ASP.NET AJAX and work well without the animation in the page. The big difference with the javascript files is that they are two libraries that we use heavily in the project -- AdvancedAjax and JSON. When they are not installed the animation works perfectly. I hope you can shed some light on what I might be doing wrong.
You might want to check Scott Guthries blog - it discusses a "Sys is Undefined" error but may be related
http://weblogs.asp.net/scottgu/archive/2006/10/29/Tip_2F00_Trick_3A00_-Handling-Errors-with-the-UpdatePanel-control-using-ASP.NET-AJAX.aspx
Thanks for the quick response. However, I've already been to the link and tried the fixes mentioned there. I've also added the following snippet to my web.config to get the animation to work on some pages (pages without the advance ajax and json libraries included)
<
locationpath="ScriptResource.axd"><system.web>
<authorization>
<allowusers="*"/>
</authorization>
</system.web>
</location>
I've followed the asp.net ajax install tutorial and have triple checked that everything that needs to be in there is in there including the
<addverb="GET"path="ScriptResource.axd"type="Microsoft.Web.Handlers.ScriptResourceHandler"validate="false"/>
Where in the web.config did you add that snipet?
just above the </configuration> at the end of the web.config...
The handler in the httphandlers section
<httpHandlers >
<removeverb="*"path="*.asmx" />
<addverb="*"path="*.asmx"validate="false"type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<addverb="GET"path="ScriptResource.axd"type="Microsoft.Web.Handlers.ScriptResourceHandler"validate="false" />
</httpHandlers>
And the
<locationpath="ScriptResource.axd" >
<system.web >
<authorization >
<allowusers="*" />
</authorization >
</system.web >
</location>
Like jody said, at the very end before the </config> and after the asp.net ajax </system.WebServer> tag
I've also tried adding my javascript files to the script manager and notifying Sys.Application by following the following located at [here (pops in new win)]. This did not work either, the same problems happened that I first posted about.
<asp:ScriptManagerrunat="server"ID="ScriptManager1">
<Scripts>
<asp:ScriptReferencePath="~/scripts/script_file1.js"/>
<asp:ScriptReferencePath="~/scripts/script_file2.js"/>
</Scripts>
</asp:ScriptManager>
After upgrading to Beta 2, any functionality that needs to use functions inside those files, was giving errors?!
After reading the"Changes between the ASP.NET AJAX ("Atlas") CTP and the Beta 2 and RTM Releases", I come to know that every external Javascript files that being referenced from ScriptManager must have a call toSys.Application.notifyScriptLoader; this will notify the Sys.Applicationthat the script files has been downloaded to the client computer, so for each external .js file add the following snippet:
if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();
Another solution thatAlessandro Gallo hasblog it is to add the following snippet to the end of each .js file:
if(Sys &&Sys.Application) {Sys.Application.notifyScriptLoaded();}
I was investigating the same bunch of Sys.Application errors on my website and couldn't solve the issue until I found the thread. I checked my .js files and added the aforementioned code to the end of each but the error still continued to show up. So I decided to remove blocks of code from one .js file to see if any of them cause any problem. And I found a piece that caused the problem!
I have the following code:
Object.prototype.startsFrom = startsFrom;
function startsFrom ( s2 )
{
return (this.toString().substring(0, s2.length) == s2 )
}
As soon I comment this piece out (it's enough to comment the first line of the piece), the errors are gone!
So if anyone has the same problem - check for this "Object.prototype..." kind of code in your .js files!
Hope this helps.
Vlad.
If your namespaces begin with Microsoft.Web.* (as I see some of the examples here doing), then you're pointing to the wrong ASP.NET AJAX version, I think. The 1.0 release of ASP.NET AJAX uses the System.Web.* namespace and web.config settings need to be set accordingly. Starting from the web.config that comes with ASP.NET AJAX or the Toolkit should get things off on the right foot.
Probably an error takes place because you are using a DatePicker or somecontrol that uses Javascript and that interferes with Ajax.NET.
Verify that you arent using other Javascript.
No comments:
Post a Comment