SSRS MVC - 仅显示空白页面

时间:2018-03-21 10:35:50

标签: asp.net-mvc ssrs-2008

我在MVC 4中有一个SSRS报告。它在运行时显示空白页面。但是当我没有显示错误时显示。我的输出页面是空白的,任何人都可以帮助我吗?

我的Report.aspx页面是

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Report.aspx.cs" 
    Inherits="Budget.Reports.Report" %>

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, 
    Culture=neutral, PublicKeyToken=89845dcd8080cc91" 
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

    <!DOCTYPE html>

    <html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt" ZoomMode="PageWidth" SizeToReportContent="true">

    <LocalReport ReportPath="Report3.rdlc">

    </LocalReport>


    </rsweb:ReportViewer>

    </div>

    </form>
    </body>
    </html>

我的Report.aspx.cs页面是

protected void Page_Load(object sender, EventArgs e)
        {
            BudgetModel bModel = new BudgetModel();

             this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;



             this.ReportViewer1.LocalReport.ReportPath = Path.Combine(Server.MapPath("~/Reports"), "Report3.rdlc");


             BudgetDataSet DataSet1 = new BudgetDataSet();

                IEnumerable<BudgetVM> reportDetails = bModel.getBudgetDetails("xxxxxx");

                ReportDataSource reportDataSource = new ReportDataSource("DataSet1", reportDetails);

                LocalReport localReport = new LocalReport();
                localReport.DataSources.Add(reportDataSource);
                string reportType = "PDF";
                string mimeType;
                string encoding;
                string fileNameExtension;


                string deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>PDF</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                "  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>" +
                "</DeviceInfo>";

                Warning[] warnings;
                string[] streams;
                byte[] renderedBytes;

                BudgetVM report = new BudgetVM();

                foreach (var r_item in reportDetails)
                {
                   // report.DIVDESC = r_item.DIVDESC;



                    ReportParameter[] parameters = new ReportParameter[3];
                    parameters[0] = new ReportParameter("DIVDESC", r_item.DIVDESC);
                    parameters[1] = new ReportParameter("AREA", r_item.AREA);
                    parameters[2] = new ReportParameter("STATEDESC", r_item.STATEDESC);


                    this.ReportViewer1.LocalReport.SetParameters(parameters);
                }
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(reportDataSource);
                    ReportViewer1.LocalReport.Refresh();

                }

我在MVC 4中有一个SSRS报告。它在运行时显示空白页面。但是当我没有显示错误时显示。我的输出页面是空白的,任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

TL; DR;

问题来自

this.ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

很久以前,我遇到了同样的问题。我还记得它让我疯了几天。幸运的是,我找到了文章Integrating SQL Server Reporting Services with ASP.NET 3.5

您还可以找到该作者关于ProccessingMode的评论。我在这里引用您的信息

enter image description here

希望它有用。