//项目列表 protected void Gridview_ProjectInfo_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_ProjectInfo.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; } string condition = GetCondition(); BindGridView_Projectinfo(condition); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Gridview_ProjectInfo.PageCount ? Gridview_ProjectInfo.PageCount - 1 : newPageIndex; Gridview_ProjectInfo.PageIndex = newPageIndex; Gridview_ProjectInfo.DataBind(); }
//项目列表绑定 private void BindGridView_Projectinfo(string Condition) { Gridview_ProjectInfo.DataSource = ppm.SelectPRMProject_Maintenance(Condition); Gridview_ProjectInfo.DataBind(); }