protected void uiGridViewSubCategories_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiTextBoxArName.Text = objData.Title; uiPanelViewCategories.Visible = false; uiPanelEdit.Visible = true; CurrentSubCategory = objData; } else if (e.CommandName == "DeleteCategory") { SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); objData.MarkAsDeleted(); objData.Save(); CurrentSubCategory = null; BindData(); } }
protected void uiGridViewSubCategories_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRowView row = (DataRowView)e.Row.DataItem; SubCategories objData = new SubCategories(); objData.LoadByPrimaryKey(Convert.ToInt32(row["SubCategoryID"].ToString())); Label l = (Label)e.Row.FindControl("uiLabelCategoryName"); l.Text = objData.Title; } }