//换页 protected void Gridview_PMPApplyRule_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_PMPApplyRuleInfo.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; } BindGridView_PMPApplyRuleinfo(""); Gridview_PMPApplyRuleInfo.DataSource = pmp.SelectPMPurchaseingApplyRule(""); Gridview_PMPApplyRuleInfo.DataBind(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Gridview_PMPApplyRuleInfo.PageCount ? Gridview_PMPApplyRuleInfo.PageCount - 1 : newPageIndex; Gridview_PMPApplyRuleInfo.PageIndex = newPageIndex; Gridview_PMPApplyRuleInfo.DataBind(); }
private void BindGridView_PMPApplyRuleinfo_One(string Condition) { try { Gridview_PMPApplyRuleInfo.DataSource = pmp.SelectPMPurchaseingApplyRule_One(Condition); Gridview_PMPApplyRuleInfo.DataBind(); Gridview_PMPApplyRuleInfo.Columns[4].Visible = true; Gridview_PMPApplyRuleInfo.Columns[5].Visible = true; } catch (Exception) { throw; } }