关于DataList分页问题!(帮顶有分)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
InitData();
}
}
/// <summary>
/// 数据初始化
/// </summary>
protected void InitData()
{
int Pageindex = 0;
Business.Select bs = new Business.Select();
bs.Area = Session[ "strArea "].ToString();
//对用于分页的类的引用
PagedDataSource pds = new PagedDataSource();
pds.DataSource = bs.SelectUser().Tables[0].DefaultView;
pds.AllowPaging = true;
//每页显示的行数
pds.PageSize = 1;
if (Request.QueryString[ "Page "] != null)
{
Pageindex = Convert.ToInt32(Request.QueryString[ "Page "]);
}
else
{
Pageindex = 1;
}
//设置当前页
if (Pageindex < 1)
{
Pageindex = 1;
&n