___ ___
/ __\ ___ _ __ ___ / _ \ __ _ __ _ ___ _ __
/ / / _ \ | '__| / _ \ / /_)/ / _` | / _` | / _ \| '__|
/ /___ | (_) || | | __// ___/ | (_| || (_| || __/| |
\____/ \___/ |_| \___|\/ \__,_| \__, | \___||_|
|___/
CorePager is a simple and easy-use pager for .Net Razor view.You can use it in any .Net Website that Written in .net framework4.6.2 or .net core.
Install-Package CorePager
- PagedList ctor:public PagedList(IEnumerable<T> ToPageItemList, int pageIndex, int pageSize, long totalItemCount)
IPagedList<OrderModel> OrderList = new PagedList<OrderModel>(list, 5, 10, 100);
//Or you can use for simple convert to PagedList
IPagedList<OrderModel> OrderList = list.ToPagedList<OrderModel>(5, 10, 100);
return View(OrderList);
@using CorePager
Or
<system.web.webPages.razor>
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
...
<add namespace="CorePager" />
</namespaces>
</pages>
</system.web.webPages.razor>
@model IPagedList<OrderModel>
<div class="clearfix">
<p class="pull-left" style="margin:20px 10px 0;">当前页:<strong>@Model.CurrentPageIndex</strong> /总计:<strong>@Model.TotalItemCount</strong> 条记录</p>
@Html.Pager(Model, new PagerOptions
{
CssClass = "pagination pull-right",
NoPageHide = true
})
</div>