protected void Search_model_Click(object sender, EventArgs e) { Grid_EquipModel.EditIndex = -1; Panel_NewName.Visible = false; UpdatePanel_NewName.Update(); Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); Guid eN_ID = new Guid(Label_enid.Text.ToString()); string condition = GetCondition3(); Grid_EquipModel.DataSource = equipNameModelL.Search_EquipModelTableInfo(condition); Grid_EquipModel.DataBind(); Panel1.Visible = false; UpdatePanel1.Update(); }
//Gridview翻页 protected void Grid_EquipModel_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_EquipModel.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; } //Guid EN_ID = new Guid(this.Label_enid.Text.ToString()); //this.Grid_EquipModel.DataSource = equipNameModelL.Search_EquipModelTable_DataInfo(EN_ID); //this.Grid_EquipModel.DataBind(); //若之前没有绑定BindGrid_EquipModel,则每次绑定Grid_EquipModel时只需调用BindGrid_EquipModel,否则每次都要用上述这种方式绑定。 //Guid EN_ID = new Guid(this.Label_enid.Text.ToString()); BindGrid_EquipModel("and EN_ID='" + Label_enid.Text.ToString() + "'"); newPageIndex = newPageIndex < 0 ? 0 : newPageIndex; newPageIndex = newPageIndex >= Grid_EquipModel.PageCount ? Grid_EquipModel.PageCount - 1 : newPageIndex; Grid_EquipModel.PageIndex = newPageIndex; Grid_EquipModel.DataBind(); }
//某设备名称下,绑定设备型号 private void BindGrid_EquipModel(string condition) { Grid_EquipModel.DataSource = equipNameModelL.Search_EquipModelTableInfo(condition); Grid_EquipModel.DataBind(); }