Microsoft Reporting: Setting subreport parameters in code

Posted by Svish on Stack Overflow See other posts from Stack Overflow or by Svish
Published on 2009-01-19T09:15:15Z Indexed on 2010/05/17 1:30 UTC
Read the original article Hit count: 315

Filed under:
|
|
|
|

How can I set a parameter of a sub-report? I have successfully hooked myself up to the SubreportProcessing event, I can find the correct sub-report through e.ReportPath, and I can add datasources through e.DataSources.Add. But I find no way of adding report parameters??

I have found people suggesting to add them to the master report, but I don't really want to do that, since the master report shouldn't have to be connected to the sub-report at all, other than that it is wrapping the sub-report.

I am using one report as a master template, printing name of the report, page numbers etc. And the subreport is going to be the report itself. And if I could only find a way to set those report parameters of the sub-report I would be good to go...

Clarification: Creating/Defining the parameters is not the problem. The problem is to set their values. I thought the natural thing to do was to do it in the SubreportProcessing event. And the SubreportProcessingEventArgs do in fact have a Parameters property. But it is read only! So how do you use that? How can I set their value?

© Stack Overflow or respective owner

Related posts about c#

Related posts about ssrs