locked
ReportViewer content based on 2 dropdowns (ReportViewer not getting Refreshed) RRS feed

  • Question

  • User-1604309053 posted

    Hi All,


    I have a scenario, wherein based on the values from 2 dropdowns (like Country and Region dropdowns), the reportviewer control gets populated.

    So in the first dropdown and second dropdown's SelectedIndexChanged event, I am calling the method SetReportParameters(), which is as below

    private void SetReportParameters
    {
    ReportParameter rp1 = new ReportParameter("Country", DropDownList1.SelectedValue);
    ReportParameter rp2 = new ReportParameter("Region", DropDownList2.SelectedValue);
           
    this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1,rp2});
    }

    I observe that the content in the report gets displayed only when I choose the values in the both the dropdowns the very first time and subsequently whenever, I change values in the first and second dropdowns, the content in the reportviewer still displays the same data (data should be different for different values chosen in the report )


    Somehow the data in the reportviewer control is not getting refreshed. Am I using the right method --> SetParameters. Can anyone please help me .

    Friday, April 29, 2011 8:49 PM

Answers

  • User-1604309053 posted

    I called this method SetReportParameters in the PagePreRender event and it fixed the problem

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, July 6, 2011 3:23 AM