服务器控件分页

时间:2016-11-19 08:52:26
【文件属性】:

文件名称:服务器控件分页

文件大小: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(); } ///

上一页 protected void Front_Click(object sender, EventArgs e) { this.currentpage.Text = Convert.ToString(Convert.ToInt32(currentpage.Text) - 1); this.LoadRankUnitPrice(); } /// 下一页 protected void Next_Click(object sender, EventArgs e) { this.currentpage.Text = Convert.ToString(Convert.ToInt32(currentpage.Text) + 1); this.LoadRankUnitPrice(); } /// 尾页 protected void Last_Click(object sender, EventArgs e) { this.currentpage.Text = this.allpage.Text; this.LoadRankUnitPrice(); }


网友评论