C# ReportViewPerformVC报告内容为空
我创建了一个只有背景图像的.rdlc 在mvc视图页面中呈现报告时,reportviewer具有空白内容。 但如果我以pdf、excel或word的形式下载,它就会有内容 在控制器页面中C# ReportViewPerformVC报告内容为空,c#,html,asp.net-mvc-5,reportviewer,C#,Html,Asp.net Mvc 5,Reportviewer,我创建了一个只有背景图像的.rdlc 在mvc视图页面中呈现报告时,reportviewer具有空白内容。 但如果我以pdf、excel或word的形式下载,它就会有内容 在控制器页面中 ReportViewer rv = new ReportViewer(); rv.Height = Unit.Parse("100%"); rv.Width = Unit.Parse("100%"); rv.LocalReport.DataSour
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>
生成
@如果(ViewBag.ReportViewer!=null)
{
@Html.ReportViewer(ViewBag.ReportViewer作为Microsoft.Reporting.WebForms.ReportViewer,新的{@style=“宽度:100%;高度:600px”})
}
in.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>
在这里,您可以找到解决此问题的方法
这些样式和元素似乎是为在Internet Explorer上使用而构建的。这是在Chrome上吗?在Internet Explorer上试用。是的,它是chrome,是的,在IE中它有内容!,但是为什么会发生这种情况呢?对于没有滚动条的页面来说,报告太大了,所以,我提供的链接没有修复工作?如果你有滚动条,这应该不会有问题。通过链接,我可以显示内容,但是内容太宽了