- private void Bind()
- {
- DataTable table = Goods.getlist();
- if (table.Rows.Count > 0)
- {
- PagedDataSource objPds = new PagedDataSource();
- objPds.DataSource = table.DefaultView;
- objPds.AllowPaging = true;
- objPds.PageSize = 9;
- this.countlabel.Text = "共:" + objPds.PageCount.ToString() + "页";
- int CurPage;
- if (Request.QueryString["Page"] != null)
- CurPage = Convert.ToInt32(Request.QueryString["Page"]);
- else
- CurPage = 1;
- objPds.CurrentPageIndex = CurPage - 1;
- this.currentlabel.Text = "当前页:" + CurPage.ToString();
- if (!objPds.IsFirstPage)
- {
- this.firstlinkbutton.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=1";
- //this.firstlinkbutton.Text = "首页";
- this.prevlinkbutton.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage - 1);
- }
- if (!objPds.IsLastPage)
- {
- this.newlinkbutton.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + Convert.ToString(CurPage + 1);
- this.lastlinkbutton.NavigateUrl = Request.CurrentExecutionFilePath + "?Page=" + objPds.PageCount.ToString();
- }
- this.gvgoods.DataSource = objPds;
- this.gvgoods.DataBind();
- }
- }