/// <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 grdRelationship_RowCommand(object sender, GridViewCommandEventArgs e) { string message = string.Empty; if (e.CommandName == "EditRow") { ViewState["RELATIONSHIPID"] = e.CommandArgument; RelationshipBO objRel = null; RelationshipBLL objrelBLL = new RelationshipBLL(); objRel = objrelBLL.GetRelationshipByID(Convert.ToInt32(ViewState["RELATIONSHIPID"])); if (objRel != null) { txtrel.Text = objRel.RELATIONSHIP; } SetUpdateMode(true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true); } else if (e.CommandName == "DeleteRow") { // ViewState["RELATIONSHIPID"] = e.CommandArgument; RelationshipBLL objrelBLL = new RelationshipBLL(); message = objrelBLL.DeleteRelation(Convert.ToInt32(e.CommandArgument)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Deleted successfully"; } SetUpdateMode(true); BindGrid(false, true); } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } }