繁体   English   中英

Visual Studio 2010,本地SSRS报表查看器14,预览为空,但导出和打印工作正常

[英]Visual Studio 2010, Local SSRS Report Viewer 14, Preview is empty, but Export and Print work fine

报表查看器预览显示为空,但是导出和打印工作正常。

我正为此而奋斗。 我需要对现有的SSRS报告进行更改,尽管所有内容似乎都在发挥作用,但最终结果还是一个空报告,即使通过“报告查看器”正在为报告获取正确的数据也是如此。 (脚注:该报告称为“ ByGroup”,但我将其更改为“ ByFields”,以确保现有报告仍然可以自行运行。这可能是某些问题的原因,但是我ve尝试小心避免这种情况。)

该项目使用在单独的.xsd文件中声明的数据表,该文件保存在网站的App_Code文件夹中。 数据表调用一个存储过程,并且所有列均存在,并且Fill和GetData方法就位。 使用数据表的“预览数据”选项,我们可以验证数据表是否正确,并返回正确的数据。 如果相关,我们可以为此提供更多数据。

我们报告的.aspx文件具有正确的Report Viewer 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如下所示: 我们报告的.rdlc看起来像这样 结果输出如下所示: 结果输出看起来像这样

我已经使用SQL Server Profiler进行了验证,当报表查看器加载页面时,它正在使用正确的参数调用SQL Server以返回所有必要的数据,但是该数据未在页面上呈现。 我知道没有页脚,也没有任何设置可以管理页面调度,因此在我修复该问题之前,它将始终显示为“ 1 of 1”,但是我期望的是一长页(在我们的测试案例中)150行原始数据的价值。

谁能提供关于我可能错过的建议?

提前非常感谢您。 我们认为这将是一个简单的更改,但是由于我们的报告编写者(工作人员)离开了,因此我们迫切需要在短时间内完成这些更改,而没有必要的技能来对其进行备份...

有了来自social.msdn的链接 ,我找到了答案。 我在.aspx文件中的ReportViewer声明中添加了SizeToReportContent="true" ,现在可以在Previewer中正确呈现输出。 没有它,就不会呈现任何内容,然后,一切就在那里!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM