PagedDataSource pg = new PagedDataSource();
pg.DataSource = ds.Tables[0].DefaultView;
pg.AllowPaging = true;
pg.PageSize = 6;
int currpage;
if (Request.QueryString["page"] != null)
{
currpage = Convert.ToInt32(Request.QueryString["page"]);
}
else
currpage = 1;
pg.CurrentPageIndex = currpage - 1;
this.Label1.Text = "第" + currpage.ToString() +"页";
if (!pg.IsFirstPage)
{
this.linkpre.Visible = true;
this.linkpre.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(currpage - 1);
pg.DataSource = ds.Tables[0].DefaultView;
pg.AllowPaging = true;
pg.PageSize = 6;
int currpage;
if (Request.QueryString["page"] != null)
{
currpage = Convert.ToInt32(Request.QueryString["page"]);
}
else
currpage = 1;
pg.CurrentPageIndex = currpage - 1;
this.Label1.Text = "第" + currpage.ToString() +"页";
if (!pg.IsFirstPage)
{
this.linkpre.Visible = true;
this.linkpre.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(currpage - 1);
}
if (!pg.IsLastPage)
{
this.linknex.Visible = true;
this.linknex.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(currpage + 1);
}
DataList1.DataSource = pg;
DataList1.DataBind();
if (!pg.IsLastPage)
{
this.linknex.Visible = true;
this.linknex.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(currpage + 1);
}
DataList1.DataSource = pg;
DataList1.DataBind();