Linq to sharepont 分页
<asp:Repeater ID="rpt_PartActivity" runat="server"> <ItemTemplate> <%#Eval("ID")%> <%# Eval("标题")%>
<%# Eval("创建日期") %>
</ItemTemplate> </asp:Repeater> <webdiyer:AspNetPager CssClass="pages" CurrentPageButtonClass="cpb" ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="尾页" onpagechanged="AspNetPager1_PageChanged" NextPageText="下一页" PrevPageText="上一页"> </webdiyer:AspNetPager>
public const int PageSize = 10; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindData(PageSize, 1); } } public void BindData(int pagesize, int pageindex) { var result=from f in siteData.共青团_团建活动 where f.团建类型 == t select new { ID = f.Id, 标题 = f.标题, 创建日期 = f.创建日期 }; AspNetPager1.PageSize = PageSize; var PartyList = result.Skip((pageindex - 1) * PageSize).Take(PageSize); AspNetPager1.RecordCount = result.Count(); rpt_PartActivity.DataSource = PartyList; rpt_PartActivity.DataBind(); } protected void AspNetPager1_PageChanged(object sender, EventArgs e) { BindData(PageSize, AspNetPager1.CurrentPageIndex); }