2011-04-12 33 views
1

Microsoft ReportViewer控件是否可以在本地模式下提示參數?Reportviewer - 以本地模式提示參數?

我已經添加了一個參數來過濾報告,它可以是一個參數的多個值。

我已經設置了參數的可用Values屬性來讀取查詢中的值列表。

我希望,如果我沒有在代碼中設置的參數值的報表會提示他們像水晶報表沒有(IM設置參數可用值數據源)

我已經做了一些研究,這和據我所知,只有當報告在服務器處理模式下運行時,報告纔會提示參數。

這是這種情況?我試圖避免必須將控件添加到頁面以選擇傳遞給報表的參數。

與本地報告相關的可用參數屬性,還是它們都在那裏?

的完整性,這裏是代碼即時通訊使用設置報表的數據源:

  //Set the report 
      Reporting.Common.SetReportEmbeddedResource(this.ReportViewer1, "Reporting.Reports.BudgetEnquiryDrilldown.rdlc"); 

      //Set the datasources 
      this.ReportViewer1.LocalReport.DataSources.Add(
       new ReportDataSource(
        "BudgetEnquiry", 
        Reporting.Repositories.BudgetEnquiryDrilldown.GetBudgetEnquiryRecords(
          base.CurrentSageDatabase, 
          base.CurrentUser.UserID))); 

      this.ReportViewer1.LocalReport.DataSources.Add(
       new ReportDataSource(
        "AccountNumber", 
        Reporting.Repositories.BudgetEnquiryDrilldown.GetAccountNumbers(
         base.CurrentSageDatabase))); 

      this.ReportViewer1.LocalReport.DataSources.Add(
       new ReportDataSource(
        "CostCentre", 
        Reporting.Repositories.BudgetEnquiryDrilldown.GetCostCentres(
         base.CurrentSageDatabase))); 

      //Refresh the report 
      this.ReportViewer1.LocalReport.Refresh(); 

回答

6

您可以用每說的ReportViewer我不覺得,但它很容易地創建一個新的形式需要的參數並將它們傳遞給報告。

看看這個:

 

    Dim params As New List(Of Microsoft.Reporting.WinForms.ReportParameter) 
' Add Parameters of type Microsoft.Reporting.Windows.ReportParameter 
    params.Add(New Microsoft.Reporting.WinForms.ReportParameter("Test", "Whatever")) 

    RptViewer.LocalReport.SetParameters(params) 

在這種情況下,帕拉姆測試被賦予值「無所謂」。

+0

感謝大衛,我想是這樣的話,到今天爲止,我對的ReportViewer :) – WraithNath 2011-04-12 14:14:16

+0

唯一的抱怨,我不同意這種說法。我不太喜歡在Reporting Services中詢問參數的方式,所以我希望能夠控制用戶看到它們的方式。 – 2011-04-12 15:12:38

2

堅持了同樣的問題,發現這個谷歌搜索

「在沒有報表服務器的,中的ReportViewer必須從你的應用程序獲得的數據後,在本地模式下,您的應用程序負責提供必要的投入報告,因此ReportViewer不會在本地報告中顯示參數提示區域,參數和數據在ReportViewer外部。「

來源:

http://webcache.googleusercontent.com/search?q=cache:c2GuADZEUSYJ:www.devx.com/dotnet/Article/30424/0/page/4+reportviewer+display+parameter+prompt+area&cd=11&hl=en&ct=clnk&gl=us&source=www.google.com

+1

謝謝,它的標準不被支持,但嘿,我們不能擁有一切! – WraithNath 2011-07-08 15:32:30