using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PeterPage.Common;

namespace PeterPage
{
    public partial class PeterpageList : System.Web.UI.Page
    {
        //定义对象实例化
        BLL.UserList bll = new BLL.UserList();
        Model.UserList model = new Model.UserList();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.Pager1.PageIndex = 0; //默认为0
                BindDaSource();
            }
        }
        //页面加载绑定数据源
        private void BindDaSource()
        {
            //实现分页，调用分页类
            Pager1.PageSize = 10; //默认一页显示10条数据信息
            PeterPages fenye1 = bll.GetSearch(model, this.Pager1.PageIndex + 1, Pager1.PageSize);
            this.rptList.DataSource = fenye1.Ds;
            rptList.DataBind();
            Pager1.RecordCount = fenye1.RecordCount;
        }

        /// <summary>
        /// 选择指定页数进行数据重新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Pager1_PageIndexChanging(object sender, Pager.NumericaArgs e)
        {
            this.Pager1.PageIndex = e.NewPageIndex;
            BindDaSource();
        }
    }
}