public JsonResult GetAllUserListJSON(jQueryDataTableParamModel param) { string sortOrder = string.Empty; var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]); if (sortColumnIndex == 0) { sortOrder = "UserId"; } else if (sortColumnIndex == 1) { sortOrder = "FullName"; } else if (sortColumnIndex == 2) { sortOrder = "Email"; } string search = "||"; //It's indicate blank filter if (!string.IsNullOrEmpty(param.sSearch)) { search = param.sSearch; } //var sortDirection = Request["sSortDir_0"]; // asc or desc var sortDirection = "desc"; int pageNo = 1; int recordPerPage = param.iDisplayLength; //Find page number from the logic if (param.iDisplayStart > 0) { pageNo = (param.iDisplayStart / recordPerPage) + 1; } DataTableProperty DataTableProperty = new DataTableProperty(); DataTableProperty.PageNo = pageNo; DataTableProperty.RecordPerPage = recordPerPage; DataTableProperty.Filter = search == "||" ? null : search; DataTableProperty.SortField = sortOrder; DataTableProperty.SortOrder = sortDirection; if (param.sSearch_1 != null) { DataTableProperty.FullName = param.sSearch_1; } if (param.sSearch_2 != null) { DataTableProperty.Email = param.sSearch_2; } var result1 = objAccessDB.GetUserList(DataTableProperty); dynamic result = ""; if (result1.EmployeeInfoList == null) { result = new List <EmployeeInfo>(); } else { result = from c in result1.EmployeeInfoList select new[] { c.UserId.ToString(), c.FullName.ToString(), c.Email.ToString(), c.ProfileImage.ToString() }; } return(Json(new { sEcho = param.sEcho, iTotalRecords = result1.totalNumberofRecord, iTotalDisplayRecords = result1.filteredRecord, aaData = result }, JsonRequestBehavior.AllowGet)); }