//populate report private void populateReportData(string HostID) { List <EventModel> eventlist = new List <EventModel>(); List <StaffModel> stafflist = new List <StaffModel>(); List <ProductInfo> productlist = new List <ProductInfo>(); ReportServiceClient report = new ReportServiceClient(); eventlist = report.findEventbyID(HostID); stafflist = report.findallstaffbyHostID(HostID); productlist = report.findallProductByHostID(HostID); if (eventlist == null && stafflist == null && productlist == null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); Response.Write("<script>alert('Report not found.');</script>"); } else if (eventlist == null && stafflist == null && productlist != null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd3 = new ReportDataSource("EventProduct", productlist); ReportViewer1.LocalReport.DataSources.Add(rd3); ReportViewer1.LocalReport.Refresh(); } else if (eventlist == null && stafflist != null && productlist == null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd2 = new ReportDataSource("EventStaff", stafflist); ReportViewer1.LocalReport.DataSources.Add(rd2); ReportViewer1.LocalReport.Refresh(); } else if (eventlist != null && stafflist == null && productlist == null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd1 = new ReportDataSource("HostEvents", eventlist); ReportViewer1.LocalReport.DataSources.Add(rd1); ReportViewer1.LocalReport.Refresh(); } else if (eventlist != null && stafflist == null && productlist != null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd1 = new ReportDataSource("HostEvents", eventlist); ReportDataSource rd3 = new ReportDataSource("EventProduct", productlist); ReportViewer1.LocalReport.DataSources.Add(rd1); ReportViewer1.LocalReport.DataSources.Add(rd3); ReportViewer1.LocalReport.Refresh(); } else if (eventlist != null && stafflist != null && productlist == null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd1 = new ReportDataSource("HostEvents", eventlist); ReportDataSource rd2 = new ReportDataSource("EventStaff", stafflist); ReportViewer1.LocalReport.DataSources.Add(rd1); ReportViewer1.LocalReport.DataSources.Add(rd2); ReportViewer1.LocalReport.Refresh(); } else if (eventlist != null && stafflist != null && productlist != null) { //Load new Reports ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource rd1 = new ReportDataSource("HostEvents", eventlist); ReportDataSource rd2 = new ReportDataSource("EventStaff", stafflist); ReportDataSource rd3 = new ReportDataSource("EventProduct", productlist); ReportViewer1.LocalReport.DataSources.Add(rd1); ReportViewer1.LocalReport.DataSources.Add(rd2); ReportViewer1.LocalReport.DataSources.Add(rd3); ReportViewer1.LocalReport.Refresh(); } }