public ActionResult HIV(string FacilityCode, string sdate, string edate) { int x = 0; //Boolean y = false; ReportsModel obj = new ReportsModel(); if (int.TryParse(FacilityCode, out x)) { obj.FacilityCode = System.Convert.ToInt32(FacilityCode); } DateTime?StartDate = DateTime.ParseExact(sdate, "dd/MM/yyyy", null); DateTime?EndDate = DateTime.ParseExact(edate, "dd/MM/yyyy", null); obj.StartDate = StartDate; obj.EndDate = EndDate; Microsoft.Reporting.WebForms.ReportViewer reportViewer = new Microsoft.Reporting.WebForms.ReportViewer(); reportViewer.ProcessingMode = ProcessingMode.Local; reportViewer.SizeToReportContent = true; //reportViewer.Width = Unit.Percentage(900); //reportViewer.Height = Unit.Percentage(900); //List<spView_Admin_Calender_ScheduleAppointmentsGetAll_Result> titles = obj.GetDetailedReport(); reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Reports\Report_WebTemplate_HIV_Test_Kits.rdlc"; reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("Header", obj.HIV_Header().ToList())); reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("Tests", obj.HIV().ToList())); reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("Consumption", obj.HIV_Summary().ToList())); ViewBag.ReportViewer = reportViewer; return(View()); }