ProductID,CategoryID,ProductName, URl
private void PopulateMenu() { DataSet ds = GetDataSetForMenu(); Menu menu = new Menu(); foreach (DataRow parentItem in ds.Tables["Categories"].Rows) { MenuItem categoryItem = new MenuItem((string)parentItem["CategoryName"]); menu.Items.Add(categoryItem); foreach (DataRow childItem in parentItem.GetChildRows("Children")) { MenuItem childrenItem = new MenuItem((string)childItem["ProductName"]); categoryItem.ChildItems.Add(childrenItem); } } Panel1.Controls.Add(menu); Panel1.DataBind(); } private DataSet GetDataSetForMenu() { SqlDataAdapter adCat = new SqlDataAdapter("SELECT * FROM Categories", con); SqlDataAdapter adProd = new SqlDataAdapter("SELECT * FROM Products", con); DataSet ds = new DataSet(); adCat.Fill(ds, "Categories"); adProd.Fill(ds, "Products"); ds.Relations.Add("Children", ds.Tables["Categories"].Columns["CategoryID"], ds.Tables["Products"].Columns["CategoryID"]); return ds; }
OP wrote:I want to set color of menu and sub-menus differently
OP wrote:on click of sub-menu I want to move on next page differently as per URL.
NavigateUrl
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)