public JsonResult LoadProvincesGrid(string sidx, string sord, int page, int rows) { //读取全部数据 string strErrText; DDSystem province = new DDSystem(); List <Province> listProvince = province.LoadProvinces(LoginAccountId, LoginStaffName, out strErrText); if (listProvince == null) { throw new Exception(strErrText); } //提取当前页面数据 int nTotalRows = listProvince.Count; int nPageIndex = page; int nPageSize = rows; int nTotalPages = nTotalRows / nPageSize; if (nTotalRows % nPageSize > 0) { nTotalPages++; } var data = listProvince.OrderBy(p => p.Name).Skip((nPageIndex - 1) * nPageSize).Take(nPageSize).ToList(); //生成表格数据 var ret = new { total = nTotalPages, page = nPageIndex, records = nTotalRows, rows = ( from p in data select new { id = p.Id, cell = new string[] { p.Id.ToString(), p.Name, p.CountryName, p.Remark, } }).ToArray() }; return(Json(ret, JsonRequestBehavior.AllowGet)); }