public string loadMenu(int pid = 0) { DAL.Category ctg = new DAL.Category(); try { System.Data.DataTable dt = ctg.SelectMenu(pid).Tables[0]; if (pid > 0 && dt.Rows.Count > 0) { menuHtml += "<ul>\n"; } for (int i = 0; i < dt.Rows.Count; i++) { menuHtml += "<li><a href=\"shop.aspx?category=" + dt.Rows[i].ItemArray[0].ToString() + "\">" + dt.Rows[i].ItemArray[1].ToString() + "</a>\n"; loadMenu(Convert.ToInt32(dt.Rows[i].ItemArray[0])); menuHtml += "</li>\n"; } if (pid > 0 && dt.Rows.Count > 0) { menuHtml += "</ul>\n"; } } catch { } return(menuHtml); }
public void loadCategory(int cid = 0) { DAL.Category ctg = new DAL.Category(); System.Data.DataTable dt = ctg.SelectMenu(cid).Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { ids += ", " + dt.Rows[i].ItemArray[0].ToString(); loadCategory((int)dt.Rows[i].ItemArray[0]); } }