Getting Javascript error with: $create(Microsoft.Reporting.WebFormsClient.ReportViewer
We have a report viewer and it adds the following jscript into the aspx file:
//<![CDATA[
Sys.Application.add_init(function() {
if (typeof Microsoft == 'undefined' ||
typeof Microsoft.Reporting == 'undefined' ||
typeof Microsoft.Reporting.WebFormsClient == 'undefined' ||
typeof Microsoft.Reporting.WebFormsClient.ReportViewer == 'undefined')
Sys.UI.DomElement.setVisible($get('ReportViewer1_HttpHandlerMissingErrorMessage'), true);
$create(Microsoft.Reporting.WebFormsClient.ReportViewer, {"_internalViewerId":"ReportViewer1_ctl03","id":"ReportViewer1"}, null, null);
});
But it keeps on showing a script error 'Microsoft is undefined' when it hits the
$create(Microsoft.Reporting.WebFormsClient.ReportViewer
line. We've just upgraded f开发者_如何学Pythonrom Silverlight 3 / VS2008 to SL4 VS2010 - is there something missing?
I get the exact same error. I followed the instructions at http://otkfounder.blogspot.com/2007/11/solving-reportviewer-rendering-issue-on.html but that didn't solve the problem and i still get the error as well. Give it a shot though, it may work for you...
Just add this line to the web.config inside the system.web httpHandlers tags
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
or the token and version you are using.
Adding
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
to <httpHandlers>
in <system.web>
(as suggested in one answer above) seems to be a deprecated setting, after I tried that I immediately got a different error:
HTTP Error 500.22 - Internal Server Error
An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.
What I found out is that that the new settings have to be here:
<system.webServer>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
...
After adding this to the Web.config
, the web site worked for me immediately. Hints how to configure the ReportViewer control itself can be found here.
精彩评论