Problem
I had faced the problem of assigning different rdlc report files to a single Reportviewer. It always shows the report which opened first.
Solution
- Clear the datasources of the LocalReport or ServerReport in ReportViewer
- Reset the ReportViewer control in the beggining of the function.
- Do assign the datasources Name and Value. The Datasources name from the dataset as string and value.
- Finally add the datasource to the reportviwer datasource in localreport or serverreport.
Sample c# code snippet to solve this problem
this.reportViewer1.Reset();
this.reportViewer1.LocalReport.DataSources.Clear();
reportDataSource.Name = "DataSet_usp_EmpFoodCouponMonthly";
reportDataSource.Value = this.DataSet.usp_EmpFoodCouponMonthly;
this.reportViewer1.LocalReport.DataSources.Add(reportDataSource);
this.reportViewer1.RefreshReport();
No comments:
Post a Comment