protected void Gridview_Kucun_PageIndexChanging(object sender, GridViewPageEventArgs e) { GridView theGrid = sender as GridView; // refer to the GridView int newPageIndex = 0; if (-2 == e.NewPageIndex) { TextBox txtNewPageIndex = null; GridViewRow pagerRow = Gridview_DiaoboMain.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox"); // refer to the TextBox with the NewPageIndex value } if (null != txtNewPageIndex && txtNewPageIndex.Text != "") { newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex } } else { newPageIndex = e.NewPageIndex; } BindDiaoboMain(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Gridview_DiaoboMain.PageCount ? Gridview_DiaoboMain.PageCount - 1 : newPageIndex; Gridview_DiaoboMain.PageIndex = newPageIndex; Gridview_DiaoboMain.DataBind(); }
//绑定调拨主表 protected void BindDiaoboMain() { Gridview_DiaoboMain.DataSource = db.Select_Allot(label11.Text.ToString().Trim()); Gridview_DiaoboMain.DataBind(); UpdatePanel_DiaoboMain.Update(); }