サブレポートのパラメーターをプログラムで設定するにはどうすればよいですか? 最上位レポートでは、次のことができます。
reportViewer.LocalReport.SetParameters ( 新しい 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 イベントを処理できます。これにより、Type ReportParameterInfoCollection のプロパティを持つ SubreportProcessingEventArgs のインスタンスが渡されます。このコレクションの値は読み取り専用です。