//Gridview编辑设备名称 protected void Grid_EquipName_RowUpdating(object sender, GridViewUpdateEventArgs e) { Guid eN_ID = new Guid(Grid_EquipName.DataKeys[e.RowIndex].Value.ToString()); //名称 if (((TextBox)(Grid_EquipName.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString() == "") { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('设备名称不能为空!')", true); return; } string eN_EquipName = Convert.ToString(((TextBox)(Grid_EquipName.Rows[e.RowIndex].Cells[1].Controls[0])).Text.Trim().ToString()); DataSet ds = equipNameModelL.Search_EquipNameInfo("and EN_EquipName = '" + eN_EquipName + " '"); DataTable dt = ds.Tables[0]; if (dt.Rows.Count != 0) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "alert", "alert('系统中已有该设备名称,不能重名!')", true); return; } Grid_EquipName.EditIndex = -1; eMEquipName_EMEquipModelTableInfo.EN_ID = eN_ID; eMEquipName_EMEquipModelTableInfo.EN_EquipName = eN_EquipName; equipNameModelL.Update_EquipNameInfo(eMEquipName_EMEquipModelTableInfo); BindGrid_EquipName(""); Txtname.Text = ""; UpdatePanel_Searchname.Update(); UpdatePanel_Name.Update(); }
//取消编辑 protected void Grid_EquipName_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { Grid_EquipName.EditIndex = -1; Txtname.Text = ""; UpdatePanel_Searchname.Update(); BindGrid_EquipName(""); }
protected void Clear_name_Click(object sender, EventArgs e) { Grid_EquipName.EditIndex = -1; Txtname.Text = ""; UpdatePanel_Searchname.Update(); BindGrid_EquipName(""); UpdatePanel_Name.Update(); Panel_NewName.Visible = false; UpdatePanel_NewName.Update(); Panel_Model.Visible = false; Panel_NewModel.Visible = false; UpdatePanel_NewModel.Update(); Panel_Spare.Visible = false; Panel_NewSpare.Visible = false; UpdatePanel_NewSpare.Update(); Panel1.Visible = false; UpdatePanel1.Update(); ; }