protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.Title; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentCategory = objData; } else if (e.CommandName == "DeleteCategory") { Categories objData = new Categories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentCategory = null; BindData(); } }