protected void Gridview_AdditionPlan_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_AdditionPlan.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; } BindMatPlan_Add(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Gridview_AdditionPlan.PageCount ? Gridview_AdditionPlan.PageCount - 1 : newPageIndex; Gridview_AdditionPlan.PageIndex = newPageIndex; Gridview_AdditionPlan.DataBind(); }
//新增材料月计划绑定 protected void BindMatPlan_Add() { Gridview_AdditionPlan.DataSource = pp.Select_MatPlan_Add(label47.Text.ToString()); Gridview_AdditionPlan.DataBind(); UpdatePanel_AdditionPlan.Update(); }