检查ReportViewer JavaScript后,我想出了以下解决方案。如果微软改变这种特殊方法,很容易破坏事情。以下代码将被添加到页面的页眉中,以确保它在ReportViewer JavaScript加载后运行,但在创建RSClientController实例之前运行。
// This replaces a method in the ReportViewer javascript. If Microsoft updates
// this particular method, it may cause problems, but that is unlikely to
// happen.The purpose of this is to redirect the user to the error page when
// an error occurs. The ReportViewer.ReportError event is not (always?) raised
// for Remote Async reports
function OnReportFrameLoaded() {
this.m_reportLoaded = true;
this.ShowWaitFrame(false);
if (this.IsAsync)
{
if(this.m_reportObject == null)
{
window.location =
'<%= HttpRuntime.AppDomainAppVirtualPath %>/Error.aspx';
}
else
{
this.m_reportObject.OnFrameVisible();
}
}
}
RSClientController.prototype.OnReportFrameLoaded = OnReportFrameLoaded;
从微软的ReportViewer脚本文件中的原始代码(Microsoft.ReportViewer.WebForms,里面8.0.0.0,.Net框架3.5 SP1)是:
function OnReportFrameLoaded()
{
this.m_reportLoaded = true;
this.ShowWaitFrame(false);
if (this.IsAsync && this.m_reportObject != null)
this.m_reportObject.OnFrameVisible();
}
RSClientController.prototype.OnReportFrameLoaded = OnReportFrameLoaded;
你做了什么异常? – 2009-09-18 03:58:36
Sproc报告中生成的自定义错误,但是这应该是无关紧要的,因为我想处理这些错误,但没有解决它们。 – 2009-09-18 05:47:55