2016-02-29 191 views
0

我已经创建了只有背景图像的.rdlc。ReportViewerForMvc报告内容为空

当我在mvc视图页面中呈现报表时,reportviewer具有空白内容。 但是,如果我下载PDF,Excel或Word,它有内容。

在控制器页

 ReportViewer rv = new ReportViewer(); 
     rv.Height = Unit.Parse("100%"); 
     rv.Width = Unit.Parse("100%"); 
     rv.LocalReport.DataSources.Clear(); 
     rv.ProcessingMode = ProcessingMode.Local; 

     rv.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) 
      + @"Report\Test.rdlc"; 


     rv.LocalReport.Refresh(); 

     ViewBag.ReportViewer = rv; 
     return View(RM); 

在.cshtml页

<div class="row"> 
     <div class="col-sm-offset-1 col-sm-10"> 
      <button>Generate</button> 
      @if (ViewBag.ReportViewer != null) 
      { 
       @Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer, new { @style = "width:100%;height:600px" }) 
      } 
     </div> 
    </div> 

在.aspx页

<%@ Page Language="C#" AutoEventWireup="True" Inherits="ReportViewerForMvc.ReportViewerWebForm" %> 

<%@ 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 style="margin: 0px; padding: 0px;"> 
    <form id="form1" runat="server"> 
     <div> 
      <asp:ScriptManager ID="ScriptManager1" runat="server"> 
       <Scripts> 
        <asp:ScriptReference Assembly="ReportViewerForMvc" Name="ReportViewerForMvc.Scripts.PostMessage.js" /> 
       </Scripts> 
      </asp:ScriptManager> 
      <rsweb:ReportViewer ID="ReportViewer1" AsyncRendering="false" runat="server" 
       Width="100%" Height="600px"></rsweb:ReportViewer> 
     </div> 
    </form> 
</body> 
</html> 

输出

enter image description here

+0

这是在Chrome上?在Internet Explorer上尝试一下。 –

+0

是的,它是铬,是的,在IE它有内容!,但为什么会发生? –

回答

1

在这里您可以找到针对此问题的修复程序SO question

看来,风格和元素是建立在Internet Explorer上使用。

+0

该报告对于没有滚动条的页面来说太大 –

+0

因此,我提供的链接没有修复工作?如果你有滚动条,这应该不成问题。 –

+0

与链接,我可以显示的内容,但内容太宽 –

相关问题