public ActionResult GetPageListJson(DataItemDetailSearchRequest searchRequest, JqGridRequest request) { var query = _dataItemService.GetByWhere(searchRequest.ItemId, searchRequest.KeyWord, searchRequest.Condition, request.PageIndex, request.RecordsCount); var dtos = CrudDtoMapper.MapEntityToDtos(query); JqGridResponse response = new JqGridResponse() { TotalPagesCount = query.TotalPages, PageIndex = request.PageIndex, TotalRecordsCount = query.TotalCount, }; foreach (DataItemDetailViewModel userInput in dtos) { response.Records.Add(new JqGridRecord(Convert.ToString(userInput.Id), userInput)); } response.Reader.RepeatItems = false; return(new JqGridJsonResult(response)); }