/// <summary> /// Set edit mode for edit comand /// Delete data from the database for delete comand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grdBanks_RowCommand(object sender, GridViewCommandEventArgs e) { string message = string.Empty; try { if (e.CommandName == "EditRow") { ShowHideSections(true, false); ViewState["BANK_ID"] = e.CommandArgument; BankBLL objBankBLL = new BankBLL(); BankBO objBank = objBankBLL.GetBankByBankID(Convert.ToInt32(ViewState["BANK_ID"])); txtBankName.Text = objBank.BankName; btnSave.Text = "Update"; btnClear.Text = "Cancel"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true); } else if (e.CommandName == "DeleteRow") { BankBLL objBankBLL = new BankBLL(); message = objBankBLL.DeleteBank(Convert.ToInt32(e.CommandArgument)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data deleted successfully"; } ClearDetails(); BindBanks(false, true); } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } } catch (Exception ex) { throw ex; } }