private void LoadProducts() { string menu = ""; EGEMech.BLL.Category cats = new EGEMech.BLL.Category(); cats.LoadAll(); for (int i = 0; i < cats.RowCount; i++) { menu += "<li><a href='products.aspx?cid=" + cats.CategoryID.ToString() + "'>" + cats.Name + "</a> "; menu += LoadSubCats(cats.CategoryID); menu += "</li>"; cats.MoveNext(); } Literal2.Text = menu; }
protected void uiGridViewCats_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditCat") { Category cat = new EGEMech.BLL.Category(); cat.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument)); CurrentCategory = cat; uiTextBoxName.Text = cat.Name; uiPanelViewCats.Visible = false; uiPanelEdit.Visible = true; } else if (e.CommandName == "DeleteCat") { try { Category cat = new EGEMech.BLL.Category(); cat.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument)); cat.MarkAsDeleted(); cat.Save(); BindData(); } catch (Exception ex) { uiLabelError.Visible = true; } } }