【问题标题】:SSRS MVC - Only displays blank pageSSRS MVC - 只显示空白页
【发布时间】:2018-03-21 10:35:50
【问题描述】:

我在 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 报告。它在运行时显示空白页。但是当我遵守时没有显示错误。我的输出页面是空白的,谁能帮助我?

【问题讨论】:

    标签: asp.net-mvc ssrs-2008


    【解决方案1】:

    TL;DR;

    问题出在

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

    很久以前,我也面临同样的问题。我仍然记得这让我疯狂了几天。幸运的是,我找到了文章Integrating SQL Server Reporting Services with ASP.NET 3.5

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

    希望有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多