簡體   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