views:

86

answers:

2

Hi there,

I keep having an error when running my web application. The error does not cause a compilation error when on live server at least a javascript error and nothing else. But the real problem is when "debug" ... javascript error stops the compilation and I have to "Continue" three times before proceeding normally my debug. But this error occurs at every refresh the page. All this using Visual Studio.

After several hours of search on google, I saw that it was a problem with the ScriptManager and Ajax. The real problem is that I do not use any Ajax on this page but the ScriptManager is on the masterpage. Worse still, on any other page on the website, that may use Ajax or not, no javascript error! Only THIS page cause this error! Any suggestion?

Note that I usualy talk french so there's probably error and sorry for this!

EDIT

There's the 3 places were compilation stop.

1. Sys.WebForms.PageRequestManager._initialize('ctl00$ctl08', document.getElementById('aspnetForm')); 

2. Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);

3. Sys.Application.initialize();
+2  A: 

Make sure you include the asp.net-ajax script manager control on your pages.


Update:

From the comment:

But ONE page which do not use Ajax or anything relativly to the scriptmanager cause this error.

Wrong. The scriptmanager control causes a bunch of javascript to be included (<link ..>-ed) in your rendered html page. Without that scriptmanager control, this javascript won't be available. Among the linked javascript is the Sys object that your error is complaining about. The only way you get the Sys is undefined error is if you have javascript for your page that in some way tries to use the Sys object (perhaps via a third part control?). So I promise you, you are using "Ajax or [something related]."

However, you said you included a scriptmanager on your master page, and that should have been good enough. The most common reasons for this to be missing are that your scriptmanager control is missing or that you execute javascript that needs it before the javascript engine has imported it. So check again and make sure 1) that the page in question isn't somehow "special" in that it doesn't use the master page, and 2) that you don't have javascript running before the asp.net ajax scripts are imported.

Joel Coehoorn
You mean, adding <asp:Scriptmanager [...] </asp:Scriptmanager> to every page instead of putting it in our Masterpage? Because there a scriptmanager in masterpage and any other page that MAY use or not at all Ajax works. But ONE page which do not use Ajax or anything relativly to the scriptmanager cause this error. This is realy weird!
Simon
I will check this out and come back for feedback. Thank you Joel
Simon
Exactly! We were having Javascript code that were running before for some reason! Thanks Joel! Nice explaination!
Simon
+1  A: 

This isn't an answer to your question, more of a suggestion for the future. I think Joel did a fine job of answering the question anyway.

For your sanity, get rid of that Microsoft AJAX. It's crap & it's not real AJAX anyway 'cause you're sending back the whole page anyway. It's just asynchronous.

Those meaningless & unnecessary "Sys is undefined" errors are part of the reason I abandoned Microsoft AJAX.

Move on to jQuery & MVC. It makes development fun again.

DaveDev
Yeah, i've heard a lot about that and most of people told me same thing or just abandon AJAX. But, in my case, I think AJAX improve user experience on website. So, I will apreciate if you can help me by giving me good ressorces and step-by-step websites were I can learn it because I just never use it. Thanks a lot, Dave! And Joel too!
Simon
DaveDev
Well, it will be my next purshase for sure. Thanks Dave!
Simon
Sorry - I misspelt Steven Sanderson
DaveDev