Try PagedList . There is a NuGet package for MVC.
@{ ViewBag.Title = "Product Listing" } @using PagedList.Mvc; //import this so we get our HTML Helper @using PagedList; //import this so we can cast our list to IPagedList (only necessary because ViewBag is dynamic) <link href="/Content/PagedList.css" rel="stylesheet" type="text/css" /> <h2>List of Products</h2> <ul> @foreach(var product in ViewBag.OnePageOfProducts){ <li>@product.Name</li> } </ul> @Html.PagedListPager( (IPagedList)ViewBag.OnePageOfProducts, page => Url.Action("Index", new { page }) )
source share