Visual Studio 2010本地SSRS报告查看器14预览为空,但导出和打印工作正常
报告查看器预览显示为空,但导出和打印工作正常。Visual Studio 2010本地SSRS报告查看器14预览为空,但导出和打印工作正常
我只是在我的智慧'结束了这一点。我需要对现有的SSRS报告进行更改,虽然所有作品似乎都在做他们的工作,但最终的结果是一个空的报告,即使报告查看器正在为报告提取正确的数据。 (脚注:该报告被称为“ByGroup”,但我将其中的部分内容更改为“ByFields”,以确保现有报告可以自行运行。这可能是一些问题的原因,我试图小心避免这种情况。)
该项目使用在网站的App_Code文件夹中保存的单独的.xsd文件中声明的数据表。数据表调用一个存储过程,并且所有列都存在,并且Fill和GetData方法就位。使用数据表“预览数据”选项,我们可以验证数据表是否正确,并返回正确的数据。如果相关,我们可以为此提供更多数据。
我们报告的.aspx文件对报表查看器14正确的注册标签:
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
我们使用的是链接到的TableAdapter定义一个ObjectDataSource:
<asp:ObjectDataSource ID="EventListingByGroup_DataInstance" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="AEMSReports.dsAEMSReportsTableAdapters.AEMSReports_056_EventListingByFieldsTableAdapter">
的<SelectParameters>
元素准确声明提供存储过程的所有参数。
中的ReportViewer定义如下:
<rsweb:ReportViewer ID="rvEventListingByGroup" runat="server" Font-Names="Verdana"
Font-Size="8pt" Height="100%" Width="850px" AsyncRendering="False"
ClientIDMode="AutoID" InternalBorderColor="204, 204, 204" InternalBorderStyle="Solid"
InternalBorderWidth="1px" ToolBarItemBorderStyle="Solid" ToolBarItemBorderWidth="1px"
ToolBarItemPressedBorderColor="51, 102, 153" ToolBarItemPressedBorderStyle="Solid" ToolBarItemPressedBorderWidth="1px"
ToolBarItemPressedHoverBackColor="153, 187, 226" >
<LocalReport ReportPath="reports\Counts_Listings\EventListingByFields056.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="EventListingByGroup_DataInstance" Name="dsAEMSReports_AEMSReports_056_EventListingByFields" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
在.aspx.cs的Page_Load常规,我们有这样的代码:
if (!IsPostBack)
{
// Set hidden fields on the form for the Select parameters...
tbFromDate.Text = Request.Form["txtFromDate"].Trim();
// ...clip...
rvEventListingByGroup.Attributes.Add("style", "margin-bottom: 30px;");
rvEventListingByGroup.Visible = true;
string[] path = HttpContext.Current.Request.Url.AbsolutePath.Split('/');
string reportPath = "";
int length = path.Length;
for (int i = 1; i < length - 1; i++)
{
if (path[i] == "Reports")
{
for (int j = i; j < length - 1; j++)
{
reportPath += path[j] + "/";
}
}
}
rvEventListingByGroup.LocalReport.ReportPath = reportPath + "EventListingByGroup056.rdlc";
rvEventListingByGroup.LocalReport.Refresh();
}
我们报告的.rdlc看起来是这样的: 并且得到的输出如下所示:
我hav使用SQL Server Profiler进行验证,当Report Viewer加载页面时,它使用正确的参数调用SQL Server以返回所有必要的数据,但数据不在页面上呈现。我知道没有页脚,也没有任何设置来管理页面,所以它总是会读取“1的1”,直到我解决这个问题,但我期望的是一长页(在我们的测试案例中)150行值得的原始数据。
任何人都可以提供什么我可以错过在这方面的建议?
非常感谢你提前。我们认为这将是一个简单的改变,但是自从我们的报告编写人员(工作人员)离开后,我们正在为获得这些更改做好准备,只是没有必要的技能来支持它们......
我找到了我的答案,感谢this link from social.msdn。我在.aspx文件的ReportViewer声明中添加了SizeToReportContent="true"
,并且现在在预览程序中正确显示了输出。没有它,没有呈现的内容,事后,它就在那里!
我们已验证导出到Excel和打印选项确实输出正确的内容,只是查看器不显示内容。 – Dan