protected void uiGridViewColors_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditColor") { Color objData = new Color(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxEnName.Text = objData.ColorNameEng; uiTextBoxArName.Text = objData.ColorNameAr; uiTextBoxColorCode.Text = objData.ColorCode; uiPanelAllCats.Visible = false; uiPanelEditCat.Visible = true; CurrentColor = objData; BindColors(); } else if (e.CommandName == "DeleteColor") { try { Color objData = new Color(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentColor = null; BindColors(); } catch (Exception ex) { uipanelError.Visible = true; } } }