2008-09-19 105 views
1

如何以編程方式爲子報表設置參數?對於頂級報告,你可以做到以下幾點:SSRS - ReportViewer LocalReport設置SubReport參數值

 
reportViewer.LocalReport.SetParameters 
(
    new Microsoft.Reporting.WebForms.ReportParameter[] 
    { 
     new Microsoft.Reporting.WebForms.ReportParameter("ParameterA", "Test"), 
     new Microsoft.Reporting.WebForms.ReportParameter("ParameterB", "1/10/2009 10:30 AM"), 
     new Microsoft.Reporting.WebForms.ReportParameter("ParameterC", "1234") 
    } 
); 

像上面的參數傳遞似乎只將它們傳遞給頂層的報告,而不是子報表。

LocalReport允許您處理SubreportProcessing事件。它向您傳遞了SubReportProcessingEventArgs的一個實例,該實例的類型爲ReportParameterInfoCollection。這個集合中的值是隻讀的。

+0

你在哪裏可以弄清楚如何完成這件事? – rsapru 2011-02-16 07:09:32

回答

1

將參數添加到父級報表中,並從父級報表(在實際報表定義中)設置子報表參數值。這是我讀過的。請讓我知道這對你有沒有用。

-1

將參數設置爲<表達式... >並使用公式構建器添加父參數。