Beta 1 - 'Sys' is undefined

Last post 10-31-2006 9:43 AM by rakeshtpatel. 8 replies.

Sort Posts:

  • Beta 1 - 'Sys' is undefined

    10-26-2006, 12:12 PM
    • Loading...
    • jason_m
    • Joined on 01-27-2006, 2:36 PM
    • Marysville, PA
    • Posts 81

    I am trying to implement error handeling similar to the example shown here http://ajax.asp.net/docs/mref/a92421a3-3be5-9c1c-4a6c-8f47be4f7910.aspx. Except my ScriptManager is located within the MasterPage.

    I get a JS error (lower left corner of IE) stating 'Sys' is undefined. I added the follow code to the Page Load event in the master.cs. The snippet was taken from http://blogs.vertigosoftware.com/alanl/archive/2006/07/25/Creating_a_Confirmation_Using_the_ModalPopup_Extender.aspx.   

    protected void Page_Load(object sender, EventArgs e) {
      Page.ClientScript.GetPostBackEventReference(this, String.Empty);
    }

    I still get the undefined error on the client. I moved the snippet above to the Page's onLoad event and still received the same error.
    Why is Sys undefined?  All other AJAX controls (Panel, Progress, Confirmation Button) work correctly.

    Jason
    Programmer
    Specialty Bakers, Inc.
  • Re: Beta 1 - 'Sys' is undefined

    10-27-2006, 1:21 AM
    Answer
    • Loading...
    • marcgel
    • Joined on 02-14-2003, 10:33 PM
    • Seattle
    • Posts 76
    • AspNetTeam

    Sys undefined means something you are tyring to use from the client library can't be used because the client library wasn't loaded. Most likely Sys.WebForms.PageRequestManager.getInstance().  You didn't give all the details of the example but I was able to get an example working with master pages based on  http://ajax.asp.net/docs/mref/a92421a3-3be5-9c1c-4a6c-8f47be4f7910.aspx with some modifications:

    1. On master page, put <asp:ScriptManager> with OnAsyncPostBackError attribute defined as in example
    2. On master page, put the server handler "ScriptManager1_AsyncPostBackError" handler
    3. On master page, set the body tag id = "bodytag"
    4. On the content page, put an <asp:ScriptManagerProxy>
    5. On the content page, put the other two server side handlers: ErrorProcessClick_Handler and SuccessProcessClick_Handler
    6. On the content page, put all of the <asp:UpdatePanel> markup between <asp:Content> tags and all of the JavaScript just after the <asp:ScriptManagerProxy> tag.

    That should work. Here's info on using ScriptManager in master pages.
    http://ajax.asp.net/docs/tutorials/enhancing/partialPageUpdatesInMasterPages.aspx

    [This posting is provided "AS IS" with no warranties, and confers no rights.]
  • Re: Beta 1 - 'Sys' is undefined

    10-27-2006, 11:19 AM
    • Loading...
    • jason_m
    • Joined on 01-27-2006, 2:36 PM
    • Marysville, PA
    • Posts 81

    Thank you for the links they were very helpful. Not only was I able to solve my error handeling problem, but I was also able to configure the AsyncPostBackTimeout for individual pages.The examples worked correctly I found it easier to to place the async error handeling logic directly in the master page markup, instead of defining it on every page.

    First I tried placing a link to the js file within the <scripts> tag of the ScriptManager on the Master page. This solved the 'Sys' undefined problem, but getInstance() returned null.   I reviewed the html To see what was going on.

    1. A script reference  to WebResource.axd?d=... is added to the page by the Script Manager.
    2. My Async Error Handeling script was added to the page.
    3. 9 more script references (both WebResource.axd and embedded js) where added to the page.

    So I embedded my script directly into the page just like the example right afer the ScriptManager and it works perfectly! If my assumptions are correct; the 'Sys' objects are defined with the 1st WebResource script because moving my script from the header to just below the first WebResource.axd removed the 'Sys' undefined error.  Somewhere within the remaining 9 scripts an instance of the script manager is initialized.  Is this why my script must be included after the Script Manger

    Jason
    Programmer
    Specialty Bakers, Inc.
  • Re: Beta 1 - 'Sys' is undefined

    10-28-2006, 12:30 AM
    • Loading...
    • marcgel
    • Joined on 02-14-2003, 10:33 PM
    • Seattle
    • Posts 76
    • AspNetTeam

    The first resource is probably web validation stuff (something you could get if you had no ScriptManager on the page). The second resource is probably where the AJAX library gets loaded. You can look at what is being sent with a tool like www.fiddlertool.com or webdev helper (http://projects.nikhilk.net/Projects/WebDevHelper.aspx) and see what each resource is exactly. Or you can just paste what is in the src attribute of the <script> tag into the browser url. It will prompt you to download. You can save as .txt file and look at the resource. 

    Anything that tries to use AJAX client library classes like PageRequestManager must be loaded after the library loads. Including your script after the ScriptManager markup is safe for now. There may be more freedom in terms of placement of script in future releases.

    [This posting is provided "AS IS" with no warranties, and confers no rights.]
  • Re: Beta 1 - 'Sys' is undefined

    10-28-2006, 2:42 AM
    • Loading...
    • jodywbcb
    • Joined on 03-12-2003, 3:52 PM
    • West Seattle,WA
    • Posts 985
    That was an excellent post - keep up the great work...wish some of the other aspects of ajax / toolkit / ctp were explained so clearly and precisely...
    -- jody
    My Blogs on .Net 2.0 and Ajax
    http://csk.wbcb.com
    http://ArtbyJody.com
  • Re: Beta 1 - 'Sys' is undefined

    10-30-2006, 12:30 PM
    • Loading...
    • hauszerm
    • Joined on 10-21-2004, 11:06 AM
    • Posts 5

    Hello

    I 've seen the 'Sys' is undefined failure in different situations.
    According to the comments in this track I modified the code and I made some improvements.

    But I am really wondering.

    Running my application  in Internet Explorer ( Version 6.0) with the Microsoft VM The error has not gone.
    Running the application in Internet Explorer (Version 6.0) with a Java(SUN) VM (Version 1.4.2. or 1.5.0) the error has gone and AJAX is running as I exspected.

    I hope, somebody can explain this  

    regards Michael

     

    Michael Hauszer
    Graz, Austria
    Filed under:
  • Re: Beta 1 - 'Sys' is undefined

    10-31-2006, 9:33 AM

    I just migrated to the latest version and I'm getting the same errors. I'm not using MasterPages.

    the error says line 84 which is highlighted below... 

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=63irtECDXXX5Bl3mQOx98w2&amp;t=632919300026739825" type="text/javascript"></script>


    <script src="Scripts/AutoCompleteProductISIN.js" type="text/javascript"></script>
    <script src="Scripts/DateInput.js" type="text/javascript"></script>
    <script src="Scripts/PopUpShowHide.js" type="text/javascript"></script>
    <script src="Scripts/PopUpCalendar.js" type="text/javascript"></script>
    <script src="Scripts/Window.js" type="text/javascript"></script>
    <script src="Scripts/Draggable.js" type="text/javascript"></script>
    <script src="Scripts/Calendar.js" type="text/javascript"></script>
    <script src="Scripts/FormatDate.js" type="text/javascript"></script>
    <script src="Scripts/AutoCompleteEventFilterTypes.js" type="text/javascript"></script>
    <script src="Scripts/AutoCompleteCurrency.js" type="text/javascript"></script>
    <script src="Scripts/ErrorMonitorCommonScripts.js" type="text/javascript"></script>
    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=NK6e7e6fsxGoxBId4RnRh5sEktUnS6t8TfIaFkhTJsp2fODl1TejWZN91LBa3onnfsiNyUYNQuC4hyTCXsJEQqqLp-0uPjcEUeZ5P8jH--Vy3wKX33_d90UZ-2OzmR3X7u4wkg-DgD2mF8QiczLJm5f1-IyswqylzgYqwHDaB9A1&amp;t=632978290104649647" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    Sys.Services.AuthenticationService._set_authenticated(true);
    // -->
    </script>

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=NK6e7e6fsxGoxBId4RnRh5sEktUnS6t8TfIaFkhTJsp2fODl1TejWZN91LBa3onnfsiNyUYNQuC4hyTCXsJEQqqLp-0uPjcEUeZ5P8jH--Vy3wKX33_d90UZ-2OzmR3XN2WSJDdqyPXDEwf-lGmDxtJR97LHwILOBs4bNve8Rpo1&amp;t=632978290104649647" type="text/javascript"></script>
    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=6Nuuo-bdzU5Fa5BmOq72CvOtWyyVuQtxLisLKTAh2CnWMQl24GJjD5c3V4PxCotUzl8DoDD7dWEn5OT5lKl_8Z8LXVnUgP6XlxW0T6TJEx1ZR-3oHckwS0mKbOwTkYxF0&amp;t=504911232000000000" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    Sys.Application.add_init(function() {
        $create(Sys.Preview.UI.Controls._UpdateProgress, {"associatedUpdatePanelId":null,"displayAfter":500,"dynamicLayout":true}, null, null, $get('updateprogress1'));
    });
    // -->
    </script>

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=CVoFxwvoJcgO-_lGWX0c51uXqvSymm8OPPcgye8PR9w1&amp;t=632919300026739825" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function WebForm_OnSubmit() {
    if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
    return true;
    }
    // -->
    </script>

          <script type="text/javascript">
    Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('frmErrorMonitorMessageFilter'));
    Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdateGridViewSummary'], [], [], 90);
    </script>

    My page has the following....

    <form id="frmErrorMonitorMessageFilter" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"/>

    <asp:UpdateProgress ID="updateprogress1" runat="server">

    <ProgressTemplate>

    <asp:Image ID="imgProgress" runat="server" ImageUrl="Images/progress.gif" ImageAlign="Middle" style="position:absolute;left:40%;top:9%;display:inline;"/>

    </ProgressTemplate>

    </asp:UpdateProgress>

    <div id="ErrorMonitorMessageSearchUserControl">

    <table class="searchcriteria">

    <tr>

    <td colspan="6" class="description">

    <asp:Button ID="btnSearch"

    runat="server"

    Text="Search"

    OnClick="btnSearch_Click" />

    <asp:Button ID="btnReset"

    runat="server"

    Text="Reset"

    OnClick="btnReset_Click" />

    </td>

    </tr>

     

    </table>

    </div>

    <asp:UpdatePanel runat="server" ID="UpdateGridViewSummary" UpdateMode="Conditional">

    <ContentTemplate>

    --- GRIDVIEW ---

    </ContentTemplate>

    </asp:UpdatePanel> 

    regards

    Rakesh

     

  • Re: Beta 1 - 'Sys' is undefined

    10-31-2006, 9:33 AM

    I just migrated to the latest version and I'm getting the same errors. I'm not using MasterPages.

    the error says line 84 which is highlighted below... 

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=63irtECDXXX5Bl3mQOx98w2&amp;t=632919300026739825" type="text/javascript"></script>


    <script src="Scripts/AutoCompleteProductISIN.js" type="text/javascript"></script>
    <script src="Scripts/DateInput.js" type="text/javascript"></script>
    <script src="Scripts/PopUpShowHide.js" type="text/javascript"></script>
    <script src="Scripts/PopUpCalendar.js" type="text/javascript"></script>
    <script src="Scripts/Window.js" type="text/javascript"></script>
    <script src="Scripts/Draggable.js" type="text/javascript"></script>
    <script src="Scripts/Calendar.js" type="text/javascript"></script>
    <script src="Scripts/FormatDate.js" type="text/javascript"></script>
    <script src="Scripts/AutoCompleteEventFilterTypes.js" type="text/javascript"></script>
    <script src="Scripts/AutoCompleteCurrency.js" type="text/javascript"></script>
    <script src="Scripts/ErrorMonitorCommonScripts.js" type="text/javascript"></script>
    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=NK6e7e6fsxGoxBId4RnRh5sEktUnS6t8TfIaFkhTJsp2fODl1TejWZN91LBa3onnfsiNyUYNQuC4hyTCXsJEQqqLp-0uPjcEUeZ5P8jH--Vy3wKX33_d90UZ-2OzmR3X7u4wkg-DgD2mF8QiczLJm5f1-IyswqylzgYqwHDaB9A1&amp;t=632978290104649647" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    Sys.Services.AuthenticationService._set_authenticated(true);
    // -->
    </script>

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=NK6e7e6fsxGoxBId4RnRh5sEktUnS6t8TfIaFkhTJsp2fODl1TejWZN91LBa3onnfsiNyUYNQuC4hyTCXsJEQqqLp-0uPjcEUeZ5P8jH--Vy3wKX33_d90UZ-2OzmR3XN2WSJDdqyPXDEwf-lGmDxtJR97LHwILOBs4bNve8Rpo1&amp;t=632978290104649647" type="text/javascript"></script>
    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=6Nuuo-bdzU5Fa5BmOq72CvOtWyyVuQtxLisLKTAh2CnWMQl24GJjD5c3V4PxCotUzl8DoDD7dWEn5OT5lKl_8Z8LXVnUgP6XlxW0T6TJEx1ZR-3oHckwS0mKbOwTkYxF0&amp;t=504911232000000000" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    Sys.Application.add_init(function() {
        $create(Sys.Preview.UI.Controls._UpdateProgress, {"associatedUpdatePanelId":null,"displayAfter":500,"dynamicLayout":true}, null, null, $get('updateprogress1'));
    });
    // -->
    </script>

    <script src="/Bnpp.Bnd.UI.Web/WebResource.axd?d=CVoFxwvoJcgO-_lGWX0c51uXqvSymm8OPPcgye8PR9w1&amp;t=632919300026739825" type="text/javascript"></script>
    <script type="text/javascript">
    <!--
    function WebForm_OnSubmit() {
    if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
    return true;
    }
    // -->
    </script>

          <script type="text/javascript">
    Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('frmErrorMonitorMessageFilter'));
    Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdateGridViewSummary'], [], [], 90);
    </script>

    My page has the following....

    <form id="frmErrorMonitorMessageFilter" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"/>

    <asp:UpdateProgress ID="updateprogress1" runat="server">

    <ProgressTemplate>

    <asp:Image ID="imgProgress" runat="server" ImageUrl="Images/progress.gif" ImageAlign="Middle" style="position:absolute;left:40%;top:9%;display:inline;"/>

    </ProgressTemplate>

    </asp:UpdateProgress>

    <div id="ErrorMonitorMessageSearchUserControl">

    <table class="searchcriteria">

    <tr>

    <td colspan="6" class="description">

    <asp:Button ID="btnSearch"

    runat="server"

    Text="Search"

    OnClick="btnSearch_Click" />

    <asp:Button ID="btnReset"

    runat="server"

    Text="Reset"

    OnClick="btnReset_Click" />

    </td>

    </tr>

     

    </table>

    </div>

    <asp:UpdatePanel runat="server" ID="UpdateGridViewSummary" UpdateMode="Conditional">

    <ContentTemplate>

    --- GRIDVIEW ---

    </ContentTemplate>

    </asp:UpdatePanel> 

    regards

    Rakesh

     

  • Re: Beta 1 - 'Sys' is undefined

    10-31-2006, 9:43 AM

    I fix the problem but not sure what caused it.

    I had the following in my Web.config

    <httpModules>

    <add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    <add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    <add name="Security Interceptor" type="Bnpp.Bnd.UI.Web.SecurityInterceptor"/>

    </httpModules>

    The first way cause the following code to have a NullException...

    private void PreRequestHandlerExecute(

    object source,

    EventArgs e

    )

    {

    HttpContext context = HttpContext.Current;

    if(context.Handler.GetType() == typeof(DefaultHttpHandler))

    return;

    which I changed to

    <httpModules>

    <add name="Security Interceptor" type="Bnpp.Bnd.UI.Web.SecurityInterceptor"/>

    <add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    <add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

    </httpModules>

Page 1 of 1 (9 items)
Microsoft Communities
Page view counter