0

目前正在迁移在页面中嵌入了 ReportViewer 控件的 ASP.NET 网站。该报告在查看器中显示良好,但当我们单击任何深入链接时,IE 会在 ScriptResource.axd 中指示“未知运行时错误”。我们使用的是 ReportViewer 12,但使用 ReportViewer 10 时遇到了同样的问题;我们认为升级到 12 可以解决这个问题,但事实并非如此。我发现updatePanel 有类似的问题,但没有帮助。我可以根据要求发布任何其他信息。

错误信息

Message: Unknown runtime error
Line: 1806
Char: 9
Code: 0
URI: http://{server-hostname}/{Path}/ScriptResource.axd?d=HURY6fWJG979L4dvjF7qlfDEC
Jny9VK-KMhlGWqyXlmaGtN_PSJwOijkOw__2eElLRRrfm_T1O2eGEITZnlywp
7rZLCcaeFP2C6YzKTzdcARY90AxK-TYzamRaw54Sjz1HmSjcvT
s_AbkVas-O2rxil2mMnRtfFW-zZTjHFDn0tcXJEiDnEzUdLZMJ
_oU2xf0&t=72e85ccd

web.config 程序集参考

<add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>
<add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"/>

页面来源

<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Dashboard.aspx.cs" Inherits="Dashboard" Title="Dashboard" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div>
        <p>
            <rsweb:ReportViewer ID="rvDashboardMain" runat="server" Font-Names="Verdana" Font-Size="8pt"
                ProcessingMode="Remote" EnableViewState="true" Width="95%" CssClass="rvFont"
                ShowBackButton="true" ShowParameterPrompts="True" PromptAreaCollapsed="true"  Height="520px">
                <ServerReport ReportPath="/{my-report-path}/{my-report}" />
            </rsweb:ReportViewer>
        </p>
    </div>
</asp:Content>

代码返回页面

public partial class Dashboard : System.Web.UI.Page {

protected void Page_Init(object sender, EventArgs e) {

    if (!Page.IsPostBack) {

        ServerReport serverReport = rvDashboardMain.ServerReport;        
        serverReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServer"]);
    }    
}

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        string UserID = HttpContext.Current.User.Identity.Name;
        UserID = UserID.Substring(UserID.IndexOf(@"\") + 1, UserID.Length - UserID.IndexOf(@"\") - 1);
    }
}

protected void rvReports_Drillthrough(object sender, Microsoft.Reporting.WebForms.DrillthroughEventArgs e)
{
    ServerReport rpt = (ServerReport)e.Report;

    rvDashboardMain.ServerReport.Refresh();
}
}

钻取链接的锚点

<a 
tabindex="26"
onclick="var rp=$get('ctl00_ContentPlaceHolder1_rvDashboardMain_ctl09_ReportControl');if(rp&amp;&amp;rp.control)rp.control.InvokeReportAction('Drillthrough','188iT0R0x0:0');return false;" onkeypress="if(event.keyCode == 13 || event.which == 13){var rp=$get('ctl00_ContentPlaceHolder1_rvDashboardMain_ctl09_ReportControl');if(rp&amp;&amp;rp.control)rp.control.InvokeReportAction('Drillthrough','188iT0R0x0:0');}return false;" 
href="" 
style="cursor:pointer;" 
class="A1d3b265b4e26456c97f9dd1067b6eec2186a" 
target="_top">2,551</a>
4

0 回答 0