Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

Last post 11-03-2009 7:33 PM by ENS15. 21 replies.

Sort Posts:

  • Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    09-28-2006, 10:14 AM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    I'm getting this annoying error (Windows 2003, IE6 w/ caching turned off) when running a page that includes the AJAX Toolkit

     

    It eventually goes away if i refresh the page enough times, but that is not the solution to tell the users of the site when this goes live....

    any ideas on what is going on and more importantly how to fix it?

    "If you make it idiot proof, they'll build a better idiot"
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    09-28-2006, 1:46 PM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    Happening some more on another page....

     this is some of the aspx markup

                <atlas:UpdatePanel ID="Panel1" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="txtEmailTo" CssClass="unwatermarked" runat="server" Width="300px" ValidationGroup="EmailTest" />
                        <asp:RequiredFieldValidator ID="reqEmailTo" ControlToValidate="txtEmailTo" ValidationGroup="EmailTest" Display="Dynamic" runat="Server"><img alt="Required!" src="/images/icons/alert_sm.gif" class="SpacedImage" /></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="rgxEmailTo" ValidationExpression="^([0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$" ControlToValidate="txtEmailTo" ValidationGroup="EmailTest" Display="Dynamic" runat="Server"><img alt="Invalid Email!" src="/images/icons/alert_sm.gif" class="SpacedImage" /></asp:RegularExpressionValidator>
                        <asp:ImageButton ID="btn1" BorderStyle="None" runat="Server" ValidationGroup="EmailTest" ImageAlign="AbsMiddle" ImageUrl="~/images/buttons/send.gif" OnClick="SendThisEmail" />
                    </ContentTemplate>
                </atlas:UpdatePanel>
    
    <atlasToolkit:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server">
        <atlasToolkit:TextBoxWatermarkProperties 
            TargetControlID="txtEmailTo" 
            WatermarkText="Enter Email Address" 
            WatermarkCssClass="watermarked" />
    </atlasToolkit:TextBoxWatermarkExtender>

     

    I visit that page, i get this error:





    I hit "cancel" and refresh the page and get that popup a few times......  then after 2 or 3 times of that i get hit with this error:





    Click "No", refresh the page... same error, so rinse and repeat, *finally* opening up the page properly






    So other than getting rid of the alert box and hitting F5, nothing is different between each page load.......

    "If you make it idiot proof, they'll build a better idiot"
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    09-29-2006, 4:37 PM
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-11-2006, 1:39 AM
    • Microsoft
    • Posts 1,842
    It sounds like you've got a race condition where something is trying to use Atlas before Atlas has finished initializing. I'll guess that you've got something attached to the page's onload event. But Atlas isn't initialized until it fires the Sys.Application.load event.

    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    10-02-2006, 10:02 AM
    • Star
      8,834 point Star
    • MorningZ
    • Member since 07-22-2002, 2:39 PM
    • Fort Lauderdale, FL
    • Posts 1,815

    David Anson:
    I'll guess that you've got something attached to the page's onload event.

    I have nothing extra wired in Javascript-wise on this page.. 

    David Anson:
    But Atlas isn't initialized until it fires the Sys.Application.load event.

    But, with the error above, even if Atlas went to fire off the Sys.Application.load event, it still wouldn't be able to find the "Sys" object to do so

    "If you make it idiot proof, they'll build a better idiot"
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    10-02-2006, 7:30 PM
    • Star
      8,710 point Star
    • David Anson
    • Member since 04-11-2006, 1:39 AM
    • Microsoft
    • Posts 1,842
    (Atlas creates the Sys.* namespace, so it will have access to it.) Could you please create a simple, self-contained sample to demonstrate this problem? It'd be very helpful if we could see it for ourselves. Failing that, you might spend some time with Firebug to see if anything stands out there that seems suggestive.

    http://blogs.msdn.com/delay

    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    06-19-2007, 1:50 PM
    • Member
      2 point Member
    • ktaitz
    • Member since 06-19-2007, 5:48 PM
    • Posts 1

    It sounds like you're missing some items in your web.config file. Set up a new dummy ajax site in VS and compare what's in that web.config with what you see in yours. 

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    03-18-2008, 8:54 AM
    • Member
      8 point Member
    • Dhinadotnet
    • Member since 01-24-2008, 11:35 AM
    • Posts 111

     Hi friends,

    Im also facing this problem, please help me to sort out this issue 

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    04-17-2008, 8:21 AM

    I also Faced the same problem. This solution may also help some developers. If ur using Script Manager and other control. Put ur java Script code at the lowest part. The error will be removed. but if it will be above the <ScriptManager> tag. Error will sure come.  RAJIV ROHILLA

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    04-17-2008, 9:50 AM
    • Participant
      1,708 point Participant
    • mvang
    • Member since 12-27-2007, 6:59 PM
    • Mid West
    • Posts 361

    You can also add/register/assign the js file with the scriptmanager itself on your page. I would recommend doing that. But yes, make sure ScriptManager is above all controls so that it is initiated before any control has to use it. Same goes with the Sys - if Sys is defined in the head - you will recieve that error because the Script Manager is defined in the body. You basically have three choices, place the javascript code at the end, reference the js file through the scriptmanager, or else place the javascript code right after the scriptmanager.

     Hope it helps!

    "If you have knowledge, let others light their candles in it."
    — Margaret Fuller
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    05-26-2008, 12:53 AM
    • Member
      6 point Member
    • Itthirit.m
    • Member since 05-26-2008, 4:48 AM
    • Posts 3

    Web.Config mistake something configuration.You can create new website with AJAXEnabledWebSite1 Template and copy some value in Web.config to your project

     Hope to help

    Itthirit Merat
     

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    05-29-2008, 2:51 PM
    • Member
      7 point Member
    • tvhkusa
    • Member since 03-18-2008, 3:51 PM
    • Posts 7

     Can you expand on the Add-Register issue... I am pretty unfamiliar with AJAX and was just following this simple tute : http://www.asp.net/AJAX/Documentation/Live/tutorials/IntroductionUpdateProgress.aspx

    about inserting an UpdateProgress control -- it had me drop a scriptManager, then a UpdatePanel, then an UpdateProgress tool on the page...thats it.

     Plus some teeny code behind for the button --- I checked my markup to see if I have JAVASCRIPT but do not see ANY javascript and have NO idea how to stop the SYS error.

     
    HERE IS MY MARKUP:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="ProgressTimerExample._Default" %>

    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Label ID="Label1" runat="server" Text="Initial Page Rendered"></asp:Label>
                    <br />
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    Processing...
                </ProgressTemplate>
            </asp:UpdateProgress>
       
        </div>
        </form>
    </body>
    </html>

     
    So I dont see anyway to move javascript around... so I would like to try to register the JS file with the scriptmanager....could you explain a little more about it?
     

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    05-30-2008, 4:06 PM
    • Member
      2 point Member
    • ricingr
    • Member since 05-30-2008, 7:57 PM
    • Posts 1

    Hi,

    it's a web.config misconfiguration :

    Try adding this :

    <httpHandlers>
                <remove verb="*" path="*.asmx"/>
                <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>
    <httpModules>
             <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>

     Thanks,

     ricingr.
     

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    05-30-2008, 5:37 PM
    • Member
      7 point Member
    • tvhkusa
    • Member since 03-18-2008, 3:51 PM
    • Posts 7

    AWESOME!  That was my answer! 


    Thanks a ton!!!!

    t

     

  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    07-23-2008, 10:19 PM
    • Member
      77 point Member
    • sujithmysore
    • Member since 04-30-2007, 5:33 AM
    • Posts 41
    thanks a lot, copying the web.config file from the sample website of the ajax control toolkit solved my problem...
  • Re: Error w/ Toolkit: Microsoft JScript runtime error: 'Sys' is undefined

    08-26-2008, 11:55 AM
    • Member
      2 point Member
    • roundmoon88
    • Member since 08-26-2008, 3:51 PM
    • Posts 1

    ricingr:

    Hi,

    it's a web.config misconfiguration :

    Try adding this :

    <httpHandlers>
                <remove verb="*" path="*.asmx"/>
                <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
    </httpHandlers>
    <httpModules>
             <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
    </httpModules>

     Thanks,

     ricingr.
     

     

     

    To ricingr :

    I've got the same problem. Thanks, it works now by your advice.

    Still give respect to others. 

Page 1 of 2 (22 items) 1 2 Next >