void btnReport_Click(object sender, EventArgs e) { btnReport.DisableServerSideValidation(); if (Page.IsValid) { int identityID = 0; int.TryParse(cboSubContractor.SelectedValue, out identityID); DateTime startDate = dteStartDate.SelectedDate.Value; startDate = startDate.Subtract(startDate.TimeOfDay); DateTime endDate = dteEndDate.SelectedDate.Value; endDate = endDate.Subtract(endDate.TimeOfDay); endDate = endDate.Add(new TimeSpan(23, 59, 59)); Facade.IJobSubContractor facJobSubcontractor = new Facade.Job(); DataSet dsSubContractedHistory; dsSubContractedHistory = facJobSubcontractor.GetSubContractedHistory(identityID, startDate, endDate); if (dsSubContractedHistory.Tables[0].Rows.Count > 0) { // Configure the report settings collection NameValueCollection reportParams = new NameValueCollection(); reportParams.Add("Start Date", startDate.ToString("dd/MM/yy")); reportParams.Add("End Date", endDate.ToString("dd/MM/yy")); // Configure the Session variables used to pass data to the report Session[Orchestrator.Globals.Constants.ReportTypeSessionVariable] = eReportType.SubContractedHistory; Session[Orchestrator.Globals.Constants.ReportDataSessionTableVariable] = dsSubContractedHistory; Session[Orchestrator.Globals.Constants.ReportDataSessionSortVariable] = String.Empty; Session[Orchestrator.Globals.Constants.ReportDataMemberSessionVariable] = "Table"; Session[Orchestrator.Globals.Constants.ReportParamsSessionVariable] = reportParams; // Show the user control reportViewer.Visible = true; } else { lblError.Text = " No runs found from " + startDate.ToString("dd/MM/yy") + " to " + endDate.ToString("dd/MM/yy") + "."; lblError.Visible = true; } } else { reportViewer.Visible = false; } }