
1. 引用 using Webdiyer.WebControls.Mvc;
2.
using Webdiyer.WebControls.Mvc; public ActionResult Index(int id=)
{ return View(Models.demodata.getlist.OrderByDescending(o=>o.Count()).ToPagedList(id,));
}
3.数据来源
public class demodata
{ public static List<string> getlist{ get { List<string> lt = new List<string>(); lt.Add(""); lt.Add(""); lt.Add(""); return lt; } }
4.视图
@using Webdiyer.WebControls.Mvc; @{
ViewBag.Title = "Index";
} @model PagedList<string> <h2>Index</h2> @foreach (var mo in Model) { @mo
}
@Html.Pager(Model).Options(o => o.SetPageIndexParameterName("id").SetHorizontalAlign("right").SetPagerItemTemplate(" {0}"))
5.访问地址/Home/Index/3