首页 > 代码库 > EF分页

EF分页

        protected virtual void InitGrid()        {            var q = _IContracts.Entities;            q = Search(q);            GridList.RecordCount = q.Count();            if (GridList.PageIndex >= GridList.PageCount && GridList.PageCount >= 1)            {                GridList.PageIndex = GridList.PageCount - 1;            }            q = q.SortBy(OrderField);            GridList.DataSource = q.Skip(GridList.PageIndex * GridList.PageSize).Take(GridList.PageSize).ToList();            GridList.DataBind();        }

 

EF分页