protected void gvDepartment_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRecord") { if (e.CommandArgument != null) { ViewState["DepartmentEditActive"] = true; ViewState["DepartmentID"] = Convert.ToInt32(e.CommandArgument.ToString()); lblModalTitle.Text = "Department Edit"; FillControls(Convert.ToInt32(e.CommandArgument.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "departmentAddEditModal();", true); } } if (e.CommandName == "DeleteRecord") { if (e.CommandArgument != null) { DepartmentBAL balDepartment = new DepartmentBAL(); if (balDepartment.Delete(Convert.ToInt32(e.CommandArgument.ToString()))) { fillDepartmentGridview(); ClientScript.RegisterStartupScript(GetType(), "SweetAlert", "swal({ type: 'success', title: 'Department Deleted Successfully', showConfirmButton: false, timer: 2000});", true); } else { lblErrorMessage.Text = balDepartment.Message; } } } }
protected void gvDepartment_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRecord") { if (e.CommandArgument != null) { DepartmentBAL balDepartment = new DepartmentBAL(); if (balDepartment.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim()))) { FillGridViewDepartment(); } else { PanelErrorMesseage.Visible = true; lblErrorMesseage.Text = balDepartment.Message; } } } else if (e.CommandName == "EditRecord") { if (e.CommandArgument != null) { Response.Redirect(e.CommandArgument.ToString().Trim()); } } }