[英]Visual Studio 2010, Local SSRS Report Viewer 14, Preview is empty, but Export and Print work fine
Report Viewer Preview displays empty, but Export and Print work fine. 报表查看器预览显示为空,但是导出和打印工作正常。
I'm just about at my wits' end over this. 我正为此而奋斗。 I'm needing to make changes to an existing SSRS Report, and while all of the pieces seem to be doing their job, the final result is an empty report, even through the Report Viewer is fetching the right data for the report. 我需要对现有的SSRS报告进行更改,尽管所有内容似乎都在发挥作用,但最终结果还是一个空报告,即使通过“报告查看器”正在为报告获取正确的数据也是如此。 (footnote:The report was called "ByGroup", but I'm changing pieces of it to "ByFields" to ensure that the existing report could still function on its own. This may be the cause of some of the issues, but I've tried to be careful to avoid that.) (脚注:该报告称为“ ByGroup”,但我将其更改为“ ByFields”,以确保现有报告仍然可以自行运行。这可能是某些问题的原因,但是我ve尝试小心避免这种情况。)
The project uses Data Tables declared in a separate .xsd file held in the App_Code folder of a website. 该项目使用在单独的.xsd文件中声明的数据表,该文件保存在网站的App_Code文件夹中。 The data table calls a stored procedure, and the columns are all present, and the Fill and GetData methods are in place. 数据表调用一个存储过程,并且所有列均存在,并且Fill和GetData方法就位。 Using the Data Table "Preview Data" option, we can verify that the Data Table is correct, and returns the correct data. 使用数据表的“预览数据”选项,我们可以验证数据表是否正确,并返回正确的数据。 We can provide more data to this end if it is relevant. 如果相关,我们可以为此提供更多数据。
Our report's .aspx file has the correct Register tag for Report Viewer 14: 我们报告的.aspx文件具有正确的Report Viewer 14注册标签:
<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>
We are using an ObjectDataSource that links to the TableAdapter definition: 我们正在使用链接到TableAdapter定义的ObjectDataSource:
<asp:ObjectDataSource ID="EventListingByGroup_DataInstance" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="AEMSReports.dsAEMSReportsTableAdapters.AEMSReports_056_EventListingByFieldsTableAdapter">
The <SelectParameters>
element accurately declares all of the parameters to feed the stored procedure. <SelectParameters>
元素准确地声明所有参数以馈送存储过程。
The ReportViewer is defined as follows: 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>
In the .aspx.cs Page_Load routine, we have this code: 在.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();
}
Our report's .rdlc looks like this: 我们报告的.rdlc如下所示: and the resulting output looks like this: 结果输出如下所示:
I have verified using SQL Server Profiler that when the Report Viewer loads the page, it is calling SQL Server with the correct parameters to return all of the necessary data, but the data isn't rendering on the page. 我已经使用SQL Server Profiler进行了验证,当报表查看器加载页面时,它正在使用正确的参数调用SQL Server以返回所有必要的数据,但是该数据未在页面上呈现。 I know there are no footers, nor are there any settings to manage paging, so it will always read "1 of 1" until I fix that, but what I'm expecting is a long page of (in our test case) 150 rows worth of raw data. 我知道没有页脚,也没有任何设置可以管理页面调度,因此在我修复该问题之前,它将始终显示为“ 1 of 1”,但是我期望的是一长页(在我们的测试案例中)150行原始数据的价值。
Can anyone offer suggestions as to what I could have missed in this? 谁能提供关于我可能错过的建议?
Thank you so much in advance. 提前非常感谢您。 We thought this would be a simple change, but since our Report Writer (staff member) left, we're on the hook for getting these changes made, in short order, without the requisite skills to back it up... 我们认为这将是一个简单的更改,但是由于我们的报告编写者(工作人员)离开了,因此我们迫切需要在短时间内完成这些更改,而没有必要的技能来对其进行备份...
I found my answer, thanks to this link from social.msdn . 有了来自social.msdn的链接 ,我找到了答案。 I added SizeToReportContent="true"
to my ReportViewer declaration in the .aspx file, and the output now rendered correctly in the Previewer. 我在.aspx文件中的ReportViewer声明中添加了SizeToReportContent="true"
,现在可以在Previewer中正确呈现输出。 Without it, no content rendered, afterwards, it was all there! 没有它,就不会呈现任何内容,然后,一切就在那里!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.