public ActionResult GetSensorDetail(string id) { try { var res = cc.GetSensorDetail(id); int?TotalRecords; if (res.Count() > 0) { TotalRecords = res.FirstOrDefault().TotalRecords; } else { TotalRecords = 0; } var resutltJson = from d in res select new string[] { d.ID_Detail_Group_Sensor, d.Detail_SensorName, d.lowerlimit.ToString(), d.upperlimit.ToString(), }; return(Json(new { iTotalRecords = TotalRecords, iTotalDisplayRecords = TotalRecords, aaData = resutltJson }, JsonRequestBehavior.AllowGet)); } catch (Exception err) { return(Content(err.ToString())); } }