Hi Team
I am returning an empty record list on my dataTable, what could be an issue? Is the issue on my calling of dbContext not correcttly? Please help me mates as i am returning an empty record list on UI. Here is my logic below for this reason.
- [HttpPost]
- public ActionResult GetList() {
- //Server side Parameter.
- int start = Convert.ToInt32(Request["start"]);
- int length = Convert.ToInt32(Request["length"]);
- string searchValue = Request["search[value]"];
- string sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"];
- string sortDirection = Request["order[0][dir]"];
- using(eNtsaOnlineRegistrationDBContext db = new eNtsaOnlineRegistrationDBContext()) {
- IQueryable < TblEventsManagements > empList = db.TblEventsManagements;
- int totalrows = empList.Count();
- int totalrowsafterfiltering = totalrows;
- if (!string.IsNullOrEmpty(searchValue)) {
- empList = empList.Where(x => x.TrainingType.Contains(searchValue) || x.TrainingDescription.Contains(searchValue) || x.Price.ToString().Contains(searchValue.ToLower()) ||
- x.Venue.Contains(searchValue) || x.Facilitator.Contains(searchValue) || x.WhoAttend.Contains(searchValue) || x.Rsvp.Contains(searchValue));
- totalrowsafterfiltering = empList.Count();
- }
- empList = empList.OrderBy(sortColumnName + " " + sortDirection).Skip(start).Take(length);
- return Json(new {
- data = empList.ToList(), draw = Request["draw"], recordsTotal = totalrows, recordsFiltered = totalrowsafterfiltering
- }, JsonRequestBehavior.AllowGet);
- }
- }
Asma KhalidPosted Feb 14, 2020, 1:12 AM
Ecco SuprastyoPosted Feb 14, 2020, 2:54 AM
Guest UserPosted Feb 14, 2020, 2:05 AM
Guest UserPosted Feb 13, 2020, 5:11 AM
Asma KhalidPosted Feb 13, 2020, 4:22 AM
Guest UserPosted Feb 13, 2020, 1:47 AM
Asma KhalidPosted Feb 13, 2020, 1:27 AM
Guest UserPosted Feb 13, 2020, 1:11 AM
Salman BegPosted Feb 13, 2020, 1:00 AM