示例#1
0
        public void fillData()
        {
            int idGDV = int.Parse(Request.Cookies["MaGDV"].Value);

            DataTable       dt      = daoNews.GetListByGDV(idGDV);
            PagedDataSource pgitems = new PagedDataSource();

            System.Data.DataView dv = new System.Data.DataView(dt);
            pgitems.DataSource  = dv;
            pgitems.AllowPaging = true;
            pgitems.PageSize    = 20;
            if (PageNumber >= pgitems.PageCount)
            {
                PageNumber = 0;
            }
            pgitems.CurrentPageIndex = PageNumber;
            if (pgitems.PageCount > 1)
            {
                rptPages.Visible = true;
                System.Collections.ArrayList pages = new System.Collections.ArrayList();
                for (int i = 0; i < pgitems.PageCount; i++)
                {
                    pages.Add((i + 1).ToString());
                }
                rptPages.DataSource = pages;
                rptPages.DataBind();
            }
            else
            {
                rptPages.Visible = false;
            }

            repeaterList.DataSource = pgitems;
            repeaterList.DataBind();
        }