public void DateBind() { int curpage = Convert.ToInt32(this.labPage.Text); PagedDataSource ps = new PagedDataSource(); IList <ExampleArticle> exampleart = examplearticlebll.Getlist(null); if (exampleart == null) { return; } ps.DataSource = exampleart; ps.AllowPaging = true; //是否可以分页 ps.PageSize = 6; //显示的数量 ps.CurrentPageIndex = curpage - 1; //取得当前页的页码 this.lnkbtnUp.Enabled = true; this.lnkbtnNext.Enabled = true; this.lnkbtnBack.Enabled = true; this.lnkbtnOne.Enabled = true; if (curpage == 1) { this.lnkbtnOne.Enabled = false; //不显示第一页按钮 this.lnkbtnUp.Enabled = false; //不显示上一页按钮 } if (curpage == ps.PageCount) { this.lnkbtnNext.Enabled = false; //不显示下一页 this.lnkbtnBack.Enabled = false; //不显示最后一页 } this.labBackPage.Text = Convert.ToString(ps.PageCount); this.DataList1.DataSource = ps; this.DataList1.DataBind(); }
public void example() //创新案例,用于在首页显示创新案例图片 { examplearticlebll = new ExampleArticleBLL(); this.DatalistExamplepic.DataSource = examplearticlebll.Getlist(null); this.DatalistExamplepic.DataBind(); }