This project has moved and is read-only. For the latest updates, please go here.

Empty IFrame When Using @Html.ReportViewer


I am getting a blank iframe when I use

@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
// GET: Report
        public ActionResult Index(ReportType reportType = ReportType.SalesOrderList)
            ReportViewModel model = new ReportViewModel();

            //model.Type = reportType;
            model.StartDate = DateTime.Now;
            model.EndDate = DateTime.Now;

            List<ReportParameter> reportParams = new List<ReportParameter>();
            reportParams.Add(new ReportParameter("Title", "Sales Order List Report"));
            ReportViewer reportViewer = new ReportViewer();
            reportViewer.ProcessingMode = ProcessingMode.Local;

            LocalReport localReport = reportViewer.LocalReport;
            localReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports/SalesOrderListReport.rdlc";

            SalesOrdersListDataSet salesOrderDataSet = new SalesOrdersListDataSet();
            salesOrderDataSet.SalesOrder.AddSalesOrderRow(Guid.NewGuid(), DateTime.Now, DateTime.Now, DateTime.Now.AddDays(1), 500, 60, 440, "Complete");
            salesOrderDataSet.SalesOrder.AddSalesOrderRow(Guid.NewGuid(), DateTime.Now, DateTime.Now, DateTime.Now.AddDays(1), 100, 12, 88, "Complete");

            ReportDataSource reportDataSource = new ReportDataSource();
            reportDataSource.Name = "Report"; //Name of the report dataset in our .RDLC file
            reportDataSource.Value = salesOrderDataSet.SalesOrder;


            ViewBag.ReportViewer = reportViewer;

            return PartialView(model);
The report viewer is not rendered on the view just a plain box of iframe. No errors on the console log.


jegtugado wrote May 10, 2016 at 5:26 AM

I tried it on internet explorer and chrome browser

JePeuxAider wrote Oct 26, 2016 at 5:56 AM

I found this too if I used an Iframe in the view.
All you need in the view is this...

@using ReportViewerForMvc;

<body >
<div id ="ReportView" class="Table-responsive"> @if (ViewBag.ReportViewer != null) { @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { scrolling = "yes", width = "100%"}) } </div> </body>