Passing Report Parameters to SubReport in VS 2010 RDLC
I'm having some troubles defining and passing report parameters to subreports in VS 2010. In VS 2008 in the design view I was able to right click and define the report parameter and have it passed through.
In VS 2010 that prompt is missing. So my question is, how can I pass a value from a parent report to a subreport in VS 2010?
Additionally, this is what is shown in the Report Properties dialog inside of VS 2010:
For the time being I have defined the parameter in the subreport manually in the XML but I'm receiving an error from the main report when I attempt to pass a parameter of any type to the subreport.
The error is :
An error occurred during local report processing.
Value cannot be null. Parameter name: value
Where I do not have a parameter named value defined anywhere.
Best Answer
Goto SubReport -> Report Data Pane -> Parameters and add the parameter you want to receive.
Goto MainReport -> Right-click SubReport -> Subreport Properties -> Parameters and add the same paramter name and pick the relevant value from the dropdown.
Handle the
SubreportProcessing
event and set the datasource for the subreport. In my case the main report datasource was of typeList<Order>
and the parameter wasOrderID
. Sample code below.