在转发器中实现分页

时间:2016-12-29 09:06:53

标签: c# asp.net entity-framework repeater

我正在尝试在转发器数据中实现分页,请注意我正在使用实体框架,因此我遇到了Internet文章的问题,因为他们经常使用ORM进行分页转发器,因此我无法识别如何继续。

这是我在一页的页面加载中使用的查询示例:

 var query = (from cd in db.CDIndexes
             join com in db.Companies on cd.cdin_CompanyId equals com.Comp_CompanyId
             join ter in db.Territories on cd.cdin_Secterr equals ter.Terr_TerritoryID
             join cat in db.Custom_Captions on cd.cdin_category equals cat.Capt_Code

             where cd.cdin_Deleted == null &&
             cat.Capt_Family == "ware_type" &&
             com.Comp_Deleted == null &&
             cd.cdin_Status == "InProgress" &&
             ids.Contains(ter.Terr_TerritoryID)/* == selected*/ &&
             com.Comp_CompanyId == c.Comp_CompanyId
             orderby cd.cdin_startunstufdate descending

             select new
             {
                 compID = com.Comp_CompanyId,
                 depID = cd.cdin_CDIndexID,
                 location = ter.Terr_Caption,
                 depNo = cd.cdin_Serial,
                 customDec = cd.cdin_Customdeclar,
                 category = cat.Capt_US,
                 goodDesc = cd.cdin_goodsDesc,
                 unitsBal = cd.cdin_RemainPackages,
                 wtBal = cd.cdin_RemainWT,
                 lcBal = cd.cdin_ActMortgageAmnt,
                 depDate = cd.cdin_startunstufdate
             }

       ).ToList();
rptCustomers.DataSource = query;
rptCustomers.DataBind();

所以我想知道如何以简单的方式在转发器中实现分页?

1 个答案:

答案 0 :(得分:0)

通过参考本文,我实现了一些配置

的代码

enter link description here