文件名称:服务器控件分页
文件大小:2KB
文件格式:TXT
更新时间:2016-11-19 08:52:26
分页
HTML控件分页:
LoadRankUnitPrice()
{
int PageNow = Convert.ToInt32(currentpage.Text);//当前页
PagedDataSource pds = new PagedDataSource();
pds.DataSource = dtcol.DefaultView;
pds.AllowPaging = true;//允许分页
pds.PageSize = 20;//每页显示20条数据
pds.CurrentPageIndex = PageNow - 1;//取得当前页的页码
First.Enabled = true;
Front.Enabled = true;
Next.Enabled = true;
Last.Enabled = true;
if (PageNow == 1)
{
First.Enabled = false;
Front.Enabled = false;
}
if (PageNow == pds.PageCount)
{
Next.Enabled = false;
Last.Enabled = false;
}
this.allpage.Text = Convert.ToString(pds.PageCount);//共多少页
this.alldata.Text = Convert.ToString(dt.Rows.Count);
this.docment.DataSource = pds;
docment.DataBind();
}
protected void First_Click(object sender, EventArgs e)
{
this.currentpage.Text = "1";
this.LoadRankUnitPrice();
}
///