本文实例为大家分享了Angular 分页的具体代码,供大家参考,具体内容如下
1、Html
MyPagination
| 序号 | 姓名 | 电话 | 邮箱 | 年龄 | 国家 | 城市 |
|---|---|---|---|---|---|---|
2、Action
[HttpPost]
public JsonResult GetPageList(int pageIndex, int pageSize, string name)
{
int pageCount = 1;
int recordTotal = 0;
int topRecordTotal = 0;
List list = new List();
try
{
list = svc.GetAllStudent();
recordTotal = list.Count();
pageCount = (int)Math.Ceiling((decimal)recordTotal / pageSize);
topRecordTotal = (pageIndex - 1 < 0 ? 0 : pageIndex - 1) * pageSize;
list = list.Skip(topRecordTotal).Take(pageSize).ToList();
}
catch (Exception)
{
throw;
}
return Json(new
{
pageIndex = pageIndex,
pageCount = pageCount,
recordTotal = recordTotal,
Data = list,
}, JsonRequestBehavior.AllowGet);
}
效果图:
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



