public ActionResult RdlcReportBankLedger(string companyId, string branchId, string accountNo, string dateFrom, string dateTo) { try { if (companyId == "null") { companyId = ""; } if (accountNo == "null") { accountNo = ""; } if (dateFrom == "null") { dateFrom = ""; } if (dateTo == "null") { dateTo = ""; } if (!string.IsNullOrEmpty(dateFrom)) { DateTime?dfrom = Convert.ToDateTime(dateFrom); dfrom = new DateTime(dfrom.Value.Year, dfrom.Value.Month, dfrom.Value.Day, 0, 0, 0); dateFrom = dfrom.Value.ToString(CultureInfo.InvariantCulture); } if (!string.IsNullOrEmpty(dateTo)) { DateTime?dto = Convert.ToDateTime(dateTo); dto = new DateTime(dto.Value.Year, dto.Value.Month, dto.Value.Day, 23, 59, 59); dateTo = dto.Value.ToString(CultureInfo.InvariantCulture); } IEnumerable <BankLedgerViewModel> bankLedgerList = new List <BankLedgerViewModel>(); if (!string.IsNullOrEmpty(companyId)) { bankLedgerList = Mapper.Map <IEnumerable <BankLedgerViewModel> >(_rawSqlService.GetAllBankLedger(companyId, branchId, accountNo, dateFrom, dateTo)); } ReportDataSource rpt = new ReportDataSource("BankLedger", bankLedgerList); RdlcReportViewerWithDate.reportDataSource = rpt; string rPath = "RdlcReport/RptBankLedger.rdlc"; Response.Redirect("~/ReportViewer/RdlcReportViewerWithDate.aspx?rPath=" + rPath + "&dfrom=" + dateFrom + "&dto=" + dateTo); return(View()); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }