日期:2014-05-17 浏览次数:20396 次
List<Library> docList = 已经分好页的数据;
PagedList<Library> list = PagedList(IEnumerable < Library > docList, pageNo, 20, 100);
public PagedList(IEnumerable<T> items, int pageIndex, int pageSize, int totalItemCount)
{
AddRange(items);
TotalItemCount = totalItemCount;
CurrentPageIndex = pageIndex;
PageSize = pageSize;
}
/*
ASP.NET MvcPager 分页组件
Copyright:2009-2011 陕西省延安市吴起县 杨涛\Webdiyer (http://www.webdiyer.com)
Source code released under Ms-PL license
*/
using System;
using System.Collections.Generic;
namespace Webdiyer.WebControls.Mvc
{
public class PagedList<T> : List<T>,IPagedList
{
public PagedList(IList<T> items, int pageIndex, int pageSize)
{
PageSize = pageSize;
TotalItemCount = items.Count;
CurrentPageIndex = pageIndex;
for (int i = StartRecordIndex - 1; i < EndRecordIndex; i++)
{
Add(items[i]);
}
}
public PagedList(IEnumerable<T> items, int pageIndex, int pageSize, int totalItemCount)
{
AddRange(items);
TotalItemCount = totalItemCount;
CurrentPageIndex = pageIndex;
PageSize = pageSize;
}
public int CurrentPageIndex { get; set; }
public int PageSize { get; set; }
public int TotalItemCount { get; set;&nb