aspnetpager 结合 linq 分页的实例,代码如下:
Code
private void Bind()
{
UserCenterDataContext db = new UserCenterDataContext();
var user = from u in db.board_UserCenter orderby u.board_AutoID descending select u;
var puser = user.Skip(pager.StartRecordIndex-1).Take(pager.PageSize);
rptList.DataSource = puser;
rptList.DataBind();
int total = user.Count(m => m.board_AutoID > 0);
pager.RecordCount = total;
}