asp.net分页

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }
        void BindData()
        {
            PagedDataSource pds = new PagedDataSource();
            IList<ManagerInfo> Infos = new Manager().GetAllManagers();
            pds.DataSource = Infos;
            pds.AllowPaging = true;
            pds.PageSize = 10;//取控件的分页大小
            pds.CurrentPageIndex = this.AspNetPager1.CurrentPageIndex - 1;//显示当前页
            //设置控件
            this.AspNetPager1.RecordCount = Infos.Count;//记录总数
            this.AspNetPager1.PageSize = 1;
            Repeater1.DataSource = pds;
            Repeater1.DataBind();
        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }
原文地址:https://www.cnblogs.com/wangzhenghua/p/2938043.html