MVC+EasyUI+三层新闻网站建立 分页查询数据功能((2)

/// <summary> /// 分页展示数据 /// </summary> /// <returns></returns> public JsonResult ShowNewsList() { //要求返回的数据json对象 {total:200,rows:[{},{}]} int pageSize = int.Parse(Request["rows"]??"10"); int pageIndex = int.Parse(Request["page"]??"1"); List<NewInfo> newInfoList= NewInfoBll.GetPageEntityList(pageIndex, pageSize); //查询所有数据 var allNews = NewInfoBll.GetRecordCount(); //把totle和rows:[{},{}]一起返回 //先建立一个匿名类 var dataJson = new { total = allNews, rows = newInfoList }; var json = Json(dataJson, JsonRequestBehavior.AllowGet); return json; }

MVC+EasyUI+三层新闻网站建立 分页查询数据功能(

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdpgfg.html