protected void Gridview_Week_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_Week.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_Week(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Gridview_Week.PageCount ? Gridview_Week.PageCount - 1 : newPageIndex; Gridview_Week.PageIndex = newPageIndex; Gridview_Week.DataBind(); }
//材料周计划绑定 protected void BindMatPlan_Week() { Gridview_Week.DataSource = pp.Select_MatPlan_Week(label14.Text.ToString()); Gridview_Week.DataBind(); UpdatePanel_Week.Update(); }