public ActionResult BindDataGrid(SearchFilter search, string StateCode, string DistrictCode, string CenterType) { try { int RecCount = 0; var items = _bussProj.GetDataGrid(search, StateCode, DistrictCode, CenterType); //if (items.Count == 0) return null; var total = (int)Math.Ceiling(RecCount / (float)search.rows); // get page count var jsonData = new { total = total, page = (total < search.page ? 1 : search.page), // set the current page records = items.Count, rows = items, }; return(Json(jsonData, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Content(ex.InnerException.Message)); } }