Tuesday, December 16, 2014

how to fix Error "0x800a1391 - JavaScript runtime error: 'Sys' is undefined"

when i put my code like the following in my side my JavaScript code

 Sys.WebForms.PageRequestManager.getInstance().add_endRequest($.unblockUI);

to unload the blockUI JQuery widget in my provider-host SharePoint app

I always get this error message popup, no matter where i put my javascript code (header section or
before the  end body tag </body>.











the fix is easy just add an asp.net script manager control after the form start tag and load the script right before the end body tag </body> to ensure the script manager is loaded first. since the button event only will
trigger after the user click on it

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

No comments:

Post a Comment