1

I am getting the following error:

Microsoft JScript runtime error: 'Sys' is undefined

While trying to execute:

<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <script language="javascript" type="text/javascript">

        //ERROR IN THIS LINE!!!
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onUpdated());


          function onUpdated() {
                // get the update progress div
                var pnlPopup = $get("div2"); 
                // make it invisible

            }

    </script>
</head>
3
  • 1
    Do you have a ScriptManager on the Page`? Commented Oct 16, 2009 at 10:49
  • 1
    Ensure your script is below the scriptmanager. Maybe try to put your script tag into body and see what happens Commented Oct 16, 2009 at 10:51
  • yes, my scriptmanager is in body... Commented Oct 16, 2009 at 10:52

5 Answers 5

6

Ensure you have a Scriptmanager on the page and the script is below the scriptmanager. Maybe try to put your script tag into body and see what happens.

I don't know how you can fix that that its not in the body, but maybe there is a callback from Sys when its loaded

You don't need brackets to tell which function is neeeded:

Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onUpdated);
Sign up to request clarification or add additional context in comments.

1 Comment

I've added the JS below the scriptmanager and it worked! But I don't like the idea of having js in the body... Can something be done about that? Any way, update your answer(add what what you've posted in comment) and i will Accept it :)
2

If that is your full code, then the problem is that the Microsoft AJAX libraries aren't being included. If it isn't your full code, then you need to post more as it's a little hard to get beyond the fact that the library isn't included. Somewhere in your file -- prior to the line you are having problems with you need to have a javascript include like:

<script type="text/javascript" src="/scripts/MicrosoftAjax.js" />

As well as probably a few others.

Note: I'm talking about the generated source. Showing more complete markup would probably also suffice.

Comments

0

I'm a bit late to the discussion here, but a simple solution is to create a "ASP.NET AJAX-Enabled Web Site" in Visual Studio and then merge the web.config from that site with your existing site.

In this way you get all the configuration you need without having to carefully read through a lot of docs. Speed is of the essence and all that :)

1 Comment

This is what I found was missing from my web.config to resolve this error: <add key="UnobtrusiveJavaScriptEnabled" value="true" />
0

You can fix this issue by setting the EnableCDN property to "true".refer this link

Comments

0

I had the same issue , after all findings I found that the required script files ("MicrosoftAjax.js", "WebForms.js","jquery", "bootstrap" etc..) were not loaded properly which was causing me 3 errors "Sys' is undefined", "webform_docallback is undefined" and "webform_initcallback' is undefined", my actual problem was I had reference to these files which where not included in my propject, my bad I have not noticed it, I have tried all the possible solutions from the internet before I really found that my js files were not included and thats the reason its not loaded properly.

Hope this helps..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.