Fail: ReportViewer Data Refresh/How to trigger ReportView.ReportRefresh RRS feed

  • Question

  • VS2010

    Have implemented reportviewer and am loading it with data in the form load event successfully.  The report takes one parameter, which I'm feeding as a default on form_load.

    But I can't get the reportviewer to refresh after changing the parameter(selected in combo box and then picked up and passed to dataset when it is refilled using table adapter[this is being done in the SelectedIndexChanged combobox event]) Then I take the dataset and assign it to the value property of a ReportDataSource.  Then I add the reportDataSource to the reportviewer's datasources collection(previously cleared it's DataSources.Then I call the reportViewer's Refresh method.  NOTHING is refreshed.  I see some comments directing people to put code in the ReportViewer's Refresh event. I've done so.  But I don't see that event ever firing even though the Refresh method is invoked.

    Others seems to have had this issue. Resolution doesn't seem perfectly clear. Please help. I've pasted some code below.

     private void cboPromoIDSpiffCusts_SelectedIndexChanged(object sender, EventArgs e)
                if (bIsLoading == false)
                        rptCPMList.LocalReport.DataSources.Clear(); //.rptCPMList.DataBindings.Clear();
                        string sPromoID = ((string)(this.cboPromoIDSpiffCusts.SelectedValue)).Substring(0, 3);
                        ReportParameter p1 = new ReportParameter("@Promo_ID"); 
                       // this.cust_Promotion_MembersTableAdapter.Fill( this.dsCPM.Cust_Promotion_Members, Convert.ToInt16(sPromoID));
                        rds.Name = "dsCPM"; 
                       // rds.Value = this.Cust_Promotion_MembersBindingSource.DataSource;
                        rptCPMList.LocalReport.SetParameters(new ReportParameter[] { p1 });
                        rptCPMList.LocalReport.Refresh(); rptCPMList.Update(); //PITA!
            private void rptCPMList_ReportRefresh(object sender, CancelEventArgs e)
                                Convert.ToInt16(((string)(this.cboPromoIDSpiffCusts.SelectedValue)).Substring(0, 3)));
                        rds.Value = dsCPM.Tables["Cust_Promotion_Members"];

    Friday, August 8, 2014 10:15 PM

All replies