How can you programmatically set the parameters for a subreport? For the top-level report, you can do the following:
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")
}
);
Passing parameters like the above only seems to pass them to the top-level report, not the subreports.
The LocalReport allows you to handle the SubreportProcessing event. That passes you an instance of SubreportProcessingEventArgs, which has a property of Type ReportParameterInfoCollection. The values in this collection are read-only.