Beispiel #1
0
        public void DateBind()
        {
            int                   curpage   = Convert.ToInt32(this.labPage.Text);
            PagedDataSource       ps        = new PagedDataSource();
            IList <PolicyArticle> policyart = policyArticlebll.Getlist(null);

            if (policyart == null)
            {
                return;
            }
            ps.DataSource           = policyart;
            ps.AllowPaging          = true;        //是否可以分页
            ps.PageSize             = 8;           //显示的数量
            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();
        }
Beispiel #2
0
 public void poliy() //政策法规,创新理论 用于在首页显示
 {
     policyarticlebll = new PolicyArticleBLL();
     this.DatalistPoliy.DataSource = policyarticlebll.Getlist(6);
     this.DatalistPoliy.DataBind();
 }