private void Populate() { StreamingLiveLib.Pages pages = StreamingLiveLib.Pages.LoadBySiteId(AppUser.Current.Site.Id); PageRepeater.DataSource = pages; PageRepeater.DataBind(); NoPagesLit.Visible = pages.Count == 0; PageListHolder.Visible = true; PageEditHolder.Visible = false; }
private void BindPageResults() { if (matchedPagesList != null && matchedPagesList.Count > 0) { string pageCount = String.Format(("Blogs({0})"), matchedPagesList.Count); PageRepeater.DataSource = matchedPagesList; PageRepeater.DataBind(); PageRepeater.Visible = true; } else { PageRepeater.Visible = false; } }
protected void SearchButton_Click(object sender, EventArgs e) { //Clear repeater controls. postrptResults.DataSource = null; postrptResults.DataBind(); PageRepeater.DataSource = null; PageRepeater.DataBind(); string keyword = SearchWordTextBox.Text; //search posts postsList = searchPosts(keyword); //search pages pagesList = searchPages(keyword); FilterPages(pagesList); //Bind the search results to repeater controls. this.BindRepeater(); PostCountLabel1.Text = postsList.Count.ToString(); MatchedPagesLabel1.Text = matchedPagesList.Count.ToString(); PagesCountLabel1.Text = pagesList.Count.ToString(); }
void BindData() { // ensure safe values if (CurrentPage > LastPage) { CurrentPage = LastPage; } // only visible if there is more than one page this.Visible = (TotalItems > PageSize); if (this.Visible) { // setup the page list - add first and previous links PartialList <ListPagerItem> pages = new PartialList <ListPagerItem>(); if (CurrentPage > 0) { if (ShowFirstAndLast) { pages.Add(new ListPagerItem("第一页", ListPagerCss.FirstPage, 0)); } pages.Add(new ListPagerItem("上一页", ListPagerCss.PreviousPage, CurrentPage - 1)); } // determine start of page links int pageRenderIndex = CurrentPage - (MaxDisplayPages / 2); if (pageRenderIndex < 0) { pageRenderIndex = 0; } if (LastPage > MaxDisplayPages && (pageRenderIndex + MaxDisplayPages) > LastPage) { pageRenderIndex = LastPage - MaxDisplayPages; } #region // Old "first page selected" approach /*int pageRenderIndex = 0; * while ((pageRenderIndex + MaxDisplayPages) <= CurrentPage) * { * pageIndex += MaxDisplayPages; * }*/ #endregion // loop to create page links for (int i = 0; i < MaxDisplayPages; i++) { pages.Add(new ListPagerItem((pageRenderIndex + 1).ToString(), ListPagerCss.Page, pageRenderIndex)); if (++pageRenderIndex >= LastPage) { break; } } // add next and last links if (CurrentPage + 1 < LastPage) { pages.Add(new ListPagerItem("下一页", ListPagerCss.NextPage, CurrentPage + 1)); if (ShowFirstAndLast) { pages.Add(new ListPagerItem("最后一页", ListPagerCss.LastPage, LastPage)); } } // output the list of page links PageRepeater.DataSource = pages; PageRepeater.DataBind(); } _NeedsBind = false; }