sharepoint多表查询
1 private static PagedDataSource pds = new PagedDataSource(); 2 protected void Page_Load(object sender, EventArgs e) 3 { 4 if (!Page.IsPostBack) 5 { 6 7 BindData(); 8 } 9 } 10 private void BindData() 11 { 12 // var ForumBox = SharePointUtility.GetListItemDictionary<IT论坛>("IT_Forums"); 13 //IEnumerable<IT论坛> LeaderMail = ForumBox.Values 14 // .OrderByDescending(item => item.创建时间); 15 var ForumBoxData = this.GetSiteData().ForumBox.Values; 16 var ForumClickBoxData = this.GetSiteData().ForumClickBox.Values; 17 var LeaderMail = (from f in ForumBoxData 18 join fc in ForumClickBoxData on f.ID equals fc.IT_ID into temp 19 from tt in temp.DefaultIfEmpty() 20 orderby f.创建时间 descending 21 select new { ID=f.ID,Url路径=f.Url路径,创建者=f.创建者,主题=f.主题,答复=f.答复,点击量= tt==null?0:tt.点击量,创建时间=f.创建时间}).ToList(); 22 int mailcount = LeaderMail.Count(); 23 if (mailcount <= 0) 24 { 25 Label1.Text = "暂无数据"; 26 } 27 else 28 { 29 Label1.Text = ""; 30 } 31 AspNetPager.RecordCount = mailcount; 32 AspNetPager.PageSize = 20; 33 34 //pds.DataSource = LeaderMail.ToList(); 35 pds.DataSource = LeaderMail; 36 pds.AllowPaging = true; //数据源 允许分页 37 pds.CurrentPageIndex = AspNetPager.CurrentPageIndex - 1; //显示 当前页 38 pds.PageSize = AspNetPager.PageSize; //取控件 分页大小 39 BindToList(); 40 } 41 private void BindToList() 42 { 43 rpt_List.DataSource = pds; 44 rpt_List.DataBind(); 45 46 } 47 protected void AspNetPager_PageChanged(object src, EventArgs e) 48 { 49 pds.CurrentPageIndex = AspNetPager.CurrentPageIndex - 1; //显示 当前页 50 pds.PageSize = AspNetPager.PageSize; //取控件 分页大小 51 BindToList(); 52 }