//Gridview翻页 protected void Grid_EquipType_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_EquipType.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; } BindGrid_EquipType(""); Grid_EquipType.DataSource = equipTypeL.Search_EquipTypeTableInfo(""); Grid_EquipType.DataBind(); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_EquipType.PageCount ? Grid_EquipType.PageCount - 1 : newPageIndex; Grid_EquipType.PageIndex = newPageIndex; Grid_EquipType.DataBind(); }
protected void Btn_Search_Click(object sender, EventArgs e) { Grid_EquipType.EditIndex = -1; string condition = GetCondition(); Grid_EquipType.DataSource = equipTypeL.Search_EquipTypeTableInfo(condition); Grid_EquipType.DataBind(); UpdatePanel_TypeItem.Update(); Panel_NewType.Visible = false; UpdatePanel_NewType.Update(); }
private void BindGrid_EquipType(string condition) { Grid_EquipType.DataSource = equipTypeL.Search_EquipTypeTableInfo(condition); Grid_EquipType.DataBind(); }