ASP.NET - microsoft jscript runtime error 'sys' is undefined

Asked By surendra kakani on 06-Dec-11 11:07 PM
I am getting script error while my page is loading

Here i am getting the error

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

Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tctl00$ContentPlaceHolder1$UpdPnlManageEntity'], [], [], 90);


Jitendra Faye replied to surendra kakani on 06-Dec-11 11:14 PM
this is because of control ID , It may be possible that you have given wrong ID,

for checking control's client ID , see view source of page.
Sakshi a replied to surendra kakani on 06-Dec-11 11:27 PM

Solutions:

Add a script manager to the master page.



do like the following example:

<asp:ScriptManager ID="sm1" runat="server">
  <Scripts>
    <asp:ScriptReference Path="Init.js" />
  </Scripts>
</asp:ScriptManager>
<asp:UpdatePanel ID="up1" runat="server">
  <ContentTemplate>
    <!-- Interesting content goes here -->
  </ContentTemplate>
</asp:UpdatePanel>

Init.js
-----
Sys.Application.add_init(AppInit);
 
function AppInit(sender) {
  Sys.WebForms.PageRequestManager.getInstance().add_endRequest(End);
}
 
function End(sender, args) { }
surendra kakani replied to Jitendra Faye on 06-Dec-11 11:27 PM
Thanks for ur reply..
the error is

Sys undefined not with the control.

surendra kakani replied to Sakshi a on 06-Dec-11 11:29 PM
i tried with this.
Asked By surendra kakani on 06-Dec-11 11:34 PM
there is no tag xhtmlConformance in my web.config
Jitendra Faye replied to surendra kakani on 07-Dec-11 12:14 AM
Try  by moving the <script type="text/javascript"></script> block containing the Sys.* calls lower down (to the last item before the close of the body's <asp:Content/> section) in the HTML on the page.
Anoop S replied to surendra kakani on 07-Dec-11 12:29 AM

Is your <script> block ahead of your ScriptManager?

http://encosia.com/2007/08/16/updated-your-webconfig-but-sys-is-still-undefined/

Suchit shah replied to surendra kakani on 07-Dec-11 12:33 AM

To resolve the issue, add the followings to the <system.web> section of web.config:


 <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>

Suchit shah replied to surendra kakani on 07-Dec-11 12:35 AM
TO Resolve the Error Add following code in your Web.Config file

<
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>