Can't pass parameters in drillthrough reports from source report to target report in local mode - Visual Studio 2010 - Windows Form Reporting App RRS feed

  • Question

  • I'm writing a simple windows forms reporting app where I press on a text box in the first report (Report1.rdlc) which then jumps to a 2nd report (Report2.rdlc) which is working ok.  Here is my problem though: I want to pass a parameter (named 'Technology') from the source report to the target report so I can apply a filter to data which will appear in the target report.  I can specify a parameter on the source report ok in the text box properties under 'Jump to report' and I can read the parameter value being passed into the DrillthroughEventArgs and apply a filter to my binding source ok accordingly through this code:

            private void reportViewer1_Drillthrough(object sender, Microsoft.Reporting.WinForms.DrillthroughEventArgs e)
                LocalReport localReport = (LocalReport)e.Report;
                if (e.ReportPath.Contains("Report2"))
                    View_MostRecentNationalReportCardBindingSource.Filter = string.Format("Technology = '{0}'", localReport.OriginalParametersToDrillthrough[0].Values[0]);
                localReport.DataSources.Add(new ReportDataSource("DataSet1", View_MostRecentNationalReportCardBindingSource));

    but...I cannot get the 2nd report to render.  After starting the program, the Report1.rdlc renders ok, but when I click on the text box which jumps to the Report2.rdlc, it says "Error occured in local report processing.  An attempt was made to set a report parameter 'Technology' that is not defined in this report."

    So, in short, I cannot see where I can specify this 'Technology' parameter in the target report or where I can specify it in code into the target report, etc.  Any explanation will be greatly appreciated.



    Sunday, September 26, 2010 4:21 AM


  • Hi,

    From your error message, we could indicate that your application doesn’t pass the parameters to the subreport, to supply data for drillthrough reports, your application must handle the Drillthrough event of the ReportViewer object. One of the arguments passed to the Drillthrough event hander method is DrillthroughEventArgs. In the event handler, the host application should examine the values of parameters passed to the drill-through report by calling the GetParameters() method on the drillthrough report. Just like this code in behind:        ReportParameterInfoCollection DrillThroughValues =  e.Report.GetParameters();   

    You could also click this link to get a reference


    Challen Fu

    Wednesday, September 29, 2010 2:57 AM