Symptom
- Running a web application with the Crystal Reports viewer on a Master page
- Results in the error: 'Sys.Application' is null or not an object
- The error occurs in the crv.js file at:
If(Typeof(Sys)! == 'undefined') {
Sys.Application.notifyScriptLoaded();
}
- This error occurs at compile time and can be ignored
Environment
- Microsoft Visual Studio .NET 2010
- Crystal Reports 2010 for VS 2010
Reproducing the Issue
- Create a new Web project in VS 2010
- Add the Crystal Reports for VS 2010 viewer to a Master Page
- Run this project
Cause
- Microsoft AJAX controls are interfering with the Viewer rendering
- Note that if an .aspx page has other .NET controls that use Microsoft AJAX, then this error will occur
Resolution
- Open the js file and find the last "if" statement in the file
- Modify the crv.js file so it reads;
if(typeof(Sys) !== 'undefined' && typeof(Sys.Application) !== 'undefined') {
Sys.Application.notifyScriptLoaded();
}
- Note that there are two crv.js files and both must be modified:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\ASP.NETClientFiles\crystalreportviewers14\js\crviewer\crv.js
C:\Inetpub\wwwroot\aspnet_client\system_web\4_0_30319\crystalreportviewers13\js\crviewer
- Alternatively, use a Try / Catch block
- This issue is being tracked under ADAPT01496652
Keywords
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem
Product
SAP Crystal Reports, developer version for Microsoft Visual Studio