Hi,
just tried to make a simple tooltip - and got following javascript error when runing the page - 'Sys' is undefined
debug stops at:
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
perhaps i missed something?
here aspx:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %> |
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" |
Namespace="System.Web.UI" TagPrefix="asp" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head id="Head1" runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
<div> |
<asp:TextBox ID="txtWithTooltip" runat="server">123</asp:TextBox> |
<img src="HelpIcon.gif" runat="server" ID="lblPrev" alt="" style="margin-left:17px;vertical-align:middle;"/> |
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="txtWithTooltip" Text="This is a tooltip" IsClientID="true"> |
</telerik:RadToolTip> |
<telerik:RadToolTip ID="RadToolTip2" runat="server" TargetControlID="lblPrev" Sticky="true" RelativeTo="Element" Skin="Web20Green" Position="BottomCenter" Text="Previous article: USNews Top 10" IsClientID="true"> |
</telerik:RadToolTip> |
</div> |
</form> |
</body> |
</html> |
26 Answers, 1 is accepted
If you start a new project and use the New Ajax-Enabled web-site template, VS.NET adds a lot of additional stuff to your web.config file, which might be required. For example, here is my autogenerated (from VS.NET web.config file)
<?xml version="1.0"?> |
<configuration> |
<configSections> |
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> |
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> |
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> |
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> |
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="Everywhere"/> |
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> |
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/> |
</sectionGroup> |
</sectionGroup> |
</sectionGroup> |
</configSections> |
<system.web> |
<pages> |
<controls> |
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
</controls> |
</pages> |
<!-- |
Set compilation debug="true" to insert debugging |
symbols into the compiled page. Because this |
affects performance, set this value to true only |
during development. |
--> |
<compilation debug="true"> |
<assemblies> |
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies> |
</compilation> |
<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> |
</system.web> |
<system.web.extensions> |
<scripting> |
<webServices> |
<!-- Uncomment this line to customize maxJsonLength and add a custom converter --> |
<!-- |
<jsonSerialization maxJsonLength="500"> |
<converters> |
<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> |
</converters> |
</jsonSerialization> |
--> |
<!-- Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate. --> |
<!-- |
<authenticationService enabled="true" requireSSL = "true|false"/> |
--> |
<!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved |
and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and |
writeAccessProperties attributes. --> |
<!-- |
<profileService enabled="true" |
readAccessProperties="propertyname1,propertyname2" |
writeAccessProperties="propertyname1,propertyname2" /> |
--> |
</webServices> |
<!-- |
<scriptResourceHandler enableCompression="true" enableCaching="true" /> |
--> |
</scripting> |
</system.web.extensions> |
<system.webServer> |
<validation validateIntegratedModeConfiguration="false"/> |
<modules> |
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
</modules> |
<handlers> |
<remove name="WebServiceHandlerFactory-Integrated"/> |
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> |
</handlers> |
</system.webServer> |
</configuration> |
Maybe, adding these web.config clauses will address the problem? Or the easier approach - start direclty with the Ajax-Enabled Web Site template which should be available in VS.NET New Project after installing MS Ajax Extensions.
Works now!
Has anyone an idea of how to integrate this into an existing web application? I keep getting the same 'Sys' undefined error. I have successfully built the example when I start a new Ajax-enabled website but ideally I would like to add this functionality to an existing page within a web application.
Thanks
After that, you need to drop an asp:ScriptManager in your page (you can add System.Web.Extensions.dll to your toolbox and drop ScriptManager from there).
Finally, you will need to modfy your web.config - check out the web.config I attached in my previous post - all lines containing references to System.Web.Extensions are needed in your web.config. You can also directly copy / paste the web.config from a fresh MS AJAX application onto your web.config if it does not contain application specific info (or merge them).
Thanks for the quick reply. I had intalled the MS AJAX extension and had a scriptmanager on the page. I had even copied the sample web.config file you had posted previously. What finally worked for me was placing the updated web.config file on the root of my web application. Initially I had only been updating the web.config file on the portion of my web site that required a login.
Thanks for the good information.
-Brent
I have cross checked the Prometheus docs and while there is information there how to proceed from a fresh new ASP.NET AJAX Web-Site, it does not provide information how to proceed with an existing vanilla ASP.NET 2.0 site - and this will be the most common starting point, I am sure, for quite some time.
This thread provides a lot of useful information that might be included in the docs in next releases of the Prometheus suite. Hopefully they will be included in the docs.
Cheers,
~Matt
i think best approach - is to check web.config settings when inserting Prometheus controls or running it and notify user that ajax settings are missing. Hope telerik read this and can consider this option in release
Alex
Thank you for the suggestions. We will research whether this can be done and implement it if possible. We will definitely add instructions in the documentation for using our Prometheus controls in existing ASP.NET 2.0 site.
Kind regards,
Tsvetie
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Hope this will be updated for SP1.
- Missing ScriptManager
- Badly configured Web.Config that doesn't contain definition for ScriptResources handler
- HttpCompression module "breaking" ScriptHandler.axd output to browser
Thanks~
The good news is that Visual Studio 2007 will automatically convert a .NET 2.0 app to a .NET 3.5 app, making all the appropriate modifications to the web.config along the way while preserving all other customizations.
The bad news is that Visual Studio 2007 isn't officially available yet.
Original blog post and credit goes ot Matt Gibbs
http://weblogs.asp.net/chrisri/archive/2007/02/02/demystifying-sys-is-undefined.aspx
Demystifying ‘Sys is undefined’
Are you running into this error on your ASP.NET AJAX enabled web site? Does it only happen on some machines or on some browsers? Here’s how you can get to the bottom of it.
Here's a little background on what is happening…
When you have a ScriptManager on a page, ASP.NET AJAX will render a few script tags to load the various ASP.NET AJAX Scripts, and some inline script to get everything initialized and running. If you view source on the page as rendered by your browser, you should see something like this:
<script type="text/javascript">
Sys.WebForms.PageRequestManager._initialize('ScriptManager1', document.getElementById('form1'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
</script>
When the browser goes to run that code, it’s going to expect Sys.WebForms.PageRequestManager to be defined somewhere. That somewhere happens to be in the other scripts that are loaded from script tags that look like this:
<script src="/MyWebApp/ScriptResource.axd?[snip - long query string]" type="text/javascript"></script>
If the browser fails to load those scripts, the script engine can’t find the definition for Sys, Sys.WebForms, Sys.WebFormsPageRequestManager, and thus the error.
So why would those scripts fail to load? We’ve seen several reasons:
1. The browser fails to load the compressed script
This is usually the case if you get the error on IE6, but not on other browsers.
The Script Resource Handler – ScriptResource.axd compresses the scripts before returning them to the browser. In pre-RTM releases, the handler did it all the time for all browsers, and it wasn’t configurable. There is an issue in one of the components of IE6 that prevents it from loading compressed scripts correctly. See KB article here. In RTM builds, we’ve made two fixes for this. One, we don’t compress if IE6 is the browser client. Two, we’ve now made compression configurable. Here’s how you can toggle the web.config.
How do you fix it? First, make sure you are using the AJAX Extensions 1.0 RTM release. That alone should be enough. You can also try turning off compression by editing your web.config to have the following:
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="false" enableCaching="true" />
</scripting>
</system.web.extensions>
2. The required configuration for ScriptResourceHandler doesn’t exist for the web.config for your application
Make sure your web.config contains the entries from the default web.config file provided with the extensions install. (default location: C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025)
3. The virtual directory you are using for your web, isn’t correctly marked as an application (thus the configuration isn’t getting loaded) - This would happen for IIS webs.
Make sure that you are using a Web Application, and not just a Virtual Directory
4. ScriptResource.axd requests return 404
This usually points to a mis-configuration of ASP.NET as a whole. On a default installation of ASP.NET, any web request to a resource ending in .axd is passed from IIS to ASP.NET via an isapi mapping. Additionally the mapping is configured to not check if the file exists. If that mapping does not exist, or the check if file exists isn't disabled, then IIS will attempt to find the physical file ScriptResource.axd, won't find it, and return 404.
You can check to see if this is the problem by coipy/pasting the full url to ScriptResource.axd from here, and seeing what it returns
<script src="/MyWebApp/ScriptResource.axd?[snip - long query string]" type="text/javascript"></script>
How do you fix this? If ASP.NET isn't properly installed at all, you can run the "aspnet_regiis.exe" command line tool to fix it up. It's located in C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727. You can run "aspnet_regiis -i -enable", which does the full registration of ASP.NET with IIS and makes sure the ISAPI is enabled in IIS6. You can also run "aspnet_regiis -s w3svc/1/root/MyWebApp" to only fix up the registration for your web application.
http://go.microsoft.com/fwlink/?LinkID=89146&clcid=0x409
Thanks~
Todd
It also came with this line in Web.config:
xhtmlConformance mode="Legacy
Which gave PageRequestManger error.
Because u have not written in .Webconfig file.
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
<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>
Thank you SOOOOOO much.
That should BE PUT in EVERY Telerik Help file.
I LOST 5 days of work beating my head against this computer.
To reiterate to everyone -
Remove this line in Web.config:
xhtmlConformance mode="Legacy
Which we did not put in the config ourselves after the VS2008 upgrade.
We will consider adding this information in our documentation. In the meantime you can get more information on it from this blog:
http://weblogs.asp.net/scottgu/archive/2006/12/10/gotcha-don-t-use-xhtmlconformance-mode-legacy-with-asp-net-ajax.aspx
All the best,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
However there is 'sys is undefined' error.
Does anyone have solution? Thanks.
The error occured for me upon loading certain pages and actually prevented some controls from loading.
I use code obtained from the internet that protects against SQL Injection via QueryString. Part of that code includes the following condition:
- Throw an exception when the QueryString is greater than 500 characters in length.
Somewhere in the Q3 2008 SP1 control suite, Telerik is using a QueryString (I think you are anyway!) that contains version numbers and public tokens like assembly references and of course this exceeds 500 characters. So my application threw an exception which stopped page loading which caused the 'sys' is undefined the error. Removing that condition from the algorithm made the site run correctly.
So my advice would be to check for (hidden) exceptions in the Application_BeginRequest function of Global.asax, particularly where QueryString length is concerned :) Because I found it on the internet, it's quite possible others have the same algorithm.
My configuration involved Telerik RadAjax 2009Q1 on Server 2008 and IIS7 using an application pool set to Classic pipeline mode. The documentation here seems to ignore this configuration.
At first, I was getting a 500 server error, however it was not an ASP.NET error, it was coming out of IIS (so there was no nice stack trace information of any kind). After some playing around, I was also getting the 404 error. Through trial and error, I was able to determine that the issue was caused by the handler configuration.
This is the setting in system.webServer/handlers that was required:
For a 32-bit installation:
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" modules="IsapiModule" scriptProcessor="%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" /> |
For a 64-bit installation:
<add name="Telerik.Web.UI.WebResource" path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" /> |
Hope this helps someone!
Wes
I have tried the code provided by Shaik n it's worked perfectly for me...
Best Regards,
Divya Nair
Can someone Point out whats wrong . It seems ok to Me
<?xml version="1.0" encoding="utf-8"?><configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings>
<add key="DisplayDateLocaleName" value=""/>
<!--<add key="ResourceFilesPath" value="D:\ABC\Inetpub\Resources\Globalization"/>-->
<add key="ResourceFilesPath" value="D:\ABC\Inetpub\GlobalizationResources"/>
</appSettings>
<system.web>
<pages>
<controls>
<add tagPrefix="radCln" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI.RadDatePicker"/>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</controls>
</pages>
<httpModules>
<add name="GlobalizationModule" type="ABC.HttpModules.GlobalizationModule, ABC.HttpModules.AccessControl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc0b46b2833ef0d3, processorArchitecture=MSIL"/>
</httpModules>
<compilation debug="true">
<assemblies>
<add assembly="System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.DirectoryServices.Protocols, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="ABC.Web.Controls, Version=1.0.0.0, Culture=neutral, PublicKeyToken=FC0B46B2833EF0D3"/>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies></compilation></system.web>
</configuration>