none
Passing report parameters from ReportViewer to Local Report RRS feed

  • Question

  • I am developing a web page containing an embedded Reportviewer control, a dropdownlist and Ajax TabContainer. The ReportViewer refreshes the report for every tab click in the TabContainer or for every SelectedIndexChanged event of the dropdownlist. The report I am generating is a 6-month trending report displaying statistical data for the last 6 months from the month and year selected in the dropdownlist. I have used Report Parameter to pass the selected date value (from dropdownlist) from the code to the Report (.rdlc). Using Expressions in report file I have displayed last 6 months names from the passing date value. The C# code looks like this.

     ReportParameter p1 = new ReportParameter("ReportParameter1", Session["ReportDate"].ToString());

     ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1 }); true;

    ReportViewer1.Visible =

     ReportViewer1.LocalReport.Refresh();The problem is I am not able to set parameters more than once using SetParameters. I will need to pass the parameter value for (a)Everytime the dropdownlist item for month is changed (b) Everytime the TabContainer ActiveTab is changed (c) When the page loads for first time displaying the report for first time. Can someone advise how to pass different values for the same report parameter under different scenarios? Can we change the parameter value passed once it has been set using SetParameters?

     


    tkota
    Wednesday, January 5, 2011 10:51 PM

All replies

  • Hi, Please if you could help me.
    I am using C# 2010 and can't find nowhere the ReportParemeters definition option.
    When running your SetParameters.... I get an Error: "An attempt was made to set report paramete "ReportParameter1" that is not defined in the report"
    !?
    Thanks


    ADH
    Wednesday, January 12, 2011 4:15 AM