//Gridview翻页 protected void Grid_BDOS_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 = Grid_BDOS.BottomPagerRow; if (null != pagerRow) { txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox1"); // 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(); BindGrid_BDOS(condition); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_BDOS.PageCount ? Grid_BDOS.PageCount - 1 : newPageIndex; Grid_BDOS.PageIndex = newPageIndex; Grid_BDOS.DataBind(); }
//绑定部门及代码列表Grid_BDOS private void BindGrid_BDOS(string condition) { Grid_BDOS.DataSource = basicCodeL.Search_BDOrganization_depcode(condition); Grid_BDOS.DataBind(); }