使用日期参数时 Reporting Services 2008 R2 javascript 错误
我在 IIS 7 下运行的 SQL Server Reporting Services R2 报表遇到 JavaScript 错误。这些报表与 IIS 运行在同一台服务器上。报表查看器控件嵌入到经典 asp.net 页面的 MVC 1.0 页面上的 iFrame 中(尽管当我单独运行报表页面时会出现相同的问题)。
我没有在报告中添加额外的自定义 JavaScript。也就是说,页面上只有报表查看器控件自带的原生javascript。
在 Firefox 4 下,当我运行带有日期参数的报表时,报表在默认日期下运行正常。如果我更改它们,我会收到以下错误:
frames.ReportViewerTouchSession0.location is null
document.getElementById("ReportViewer_ctl00").ParametersController is undefined
报告不会刷新,无论是通过自动回发还是通过“查看报告”按钮手动触发。
IE8 我得到这个:
'document.getElementById(...).ParametersController' is null or not an object
IE8 的调试器在 ViewState 中的某个随机位置中断。
IE9 的错误有所不同(当您单击日期选择器时):
Unable to get value of the property 'ToggleVisibility': object is null or undefined
Unable to get value of the property 'HideActiveDropDown': object is null or undefined
同样,调试器无法在任何源代码中为我提供有用的行号。
不存在任何可能表明脚本未加载的 404 网络错误。
在 True
和 False
之间更改 AsyncRendering
属性不会产生任何影响。
我发现您需要在 web.config 详见此处。这解决了我遇到的其他一些问题,但这个问题仍然存在。
我要用这个来撕掉我的头发!
为了完整起见,下面是该页面的 asp.net 代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="Tenders.Web.Report" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"></head>
<body>
<form id="form1" action="/Report.aspx" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" ScriptMode="Release">
</asp:ScriptManager>
<asp:UpdatePanel ID="ReportViewerUP" runat="server">
<ContentTemplate>
<rsweb:ReportViewer ID="ReportViewer" runat="server" Width="100%" ProcessingMode="Local"
InteractivityPostBackMode="AlwaysAsynchronous" AsyncRendering="true">
</rsweb:ReportViewer>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
I'm getting javascript errors on my SQL Server Reporting Services R2 reports running under IIS 7. The reports are running on the same server as IIS. The report viewer control is embedded in an iFrame on an MVC 1.0 page to a classic asp.net page (although the same problems occur when I run the report page on its own).
I have not added extra custom javascript on the reports. That is to say, there is only the stock javascript that comes with the report viewer control on the page.
Under Firefox 4, when I run a report with a date parameter, the report runs OK with the default dates. If I change them, I get these errors:
frames.ReportViewerTouchSession0.location is null
document.getElementById("ReportViewer_ctl00").ParametersController is undefined
The report does not refresh, either by the automatic post back or if I manually trigger one via the "View Report" button.
IE8 I get this:
'document.getElementById(...).ParametersController' is null or not an object
IE8's debugger breaks on some random location in the ViewState.
IE9's error is different (when you click on the date picker):
Unable to get value of the property 'ToggleVisibility': object is null or undefined
Unable to get value of the property 'HideActiveDropDown': object is null or undefined
Again, the debugger can't give me a useful line number in any source code.
There aren't any 404 network errors that might indicate scripts aren't being loaded.
Changing the AsyncRendering
property between True
and False
doesn't have any affect.
I've found that you need to move the web hander in web.config as detailed here. Which fixed some other problems I was having, but this problem remains.
I'm tearing my hair out with this one!
For completeness, here's the asp.net code for the page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" Inherits="Tenders.Web.Report" %>
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"></head>
<body>
<form id="form1" action="/Report.aspx" runat="server">
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="true" ScriptMode="Release">
</asp:ScriptManager>
<asp:UpdatePanel ID="ReportViewerUP" runat="server">
<ContentTemplate>
<rsweb:ReportViewer ID="ReportViewer" runat="server" Width="100%" ProcessingMode="Local"
InteractivityPostBackMode="AlwaysAsynchronous" AsyncRendering="true">
</rsweb:ReportViewer>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来我使用了错误版本的报表查看器控件。将
Microsoft.ReportViewer.WebForms
程序集的项目和 web.config 引用从 v9 更改为 v10 已修复该问题。请参阅此连接错误以获取更多信息(包括重现该错误和修复的演示项目):
https://connect.microsoft.com/VisualStudio/feedback/details/694408/reporting-services-2008-r2-reportviewer-javascript-errors-when-using-date-parameters
It appears I was using the wrong version of the report viewer control. Changing project and web.config reference from v9 to v10 of the
Microsoft.ReportViewer.WebForms
assembly has fixed the issue.See this connect bug for more info (including demo projects to reproduce the bug and the fix):
https://connect.microsoft.com/VisualStudio/feedback/details/694408/reporting-services-2008-r2-reportviewer-javascript-errors-when-using-date-parameters