Hi
Have created asp.net menu control based on database dynmically but am struck at how to check whether the parent menu item have already have this child itemmenu or not.
If already have the child itemmenu, it has to check and shouldnt add that childitem in the menuitem control.
dt = ds.Tables[0]; string Item1 = "Parent_Menu='Home'";
DataRow[] dataChilditem1 = dt.Select(Item1); foreach (DataRow dr in dataChilditem1) { MenuItem mnu = new MenuItem(dr["Child_Menu"].ToString(), "", "", ""); if ((mnu.Text == "Services") && (mnu.Text != null)) { mnu.NavigateUrl = "~/Services.aspx"; menu1.FindItem(dr["Parent_Menu"].ToString()).ChildItems.Add(mnu); } ..........etc
DataRow[] dataChilditem1 = dt.Select(Item1); foreach (DataRow dr in dataChilditem1) { MenuItem mnu = new MenuItem(dr["Child_Menu"].ToString(), "", "", ""); if ((mnu.Text == "Services") && (mnu.Text != null))
{ mnu.NavigateUrl = "~/Services.aspx"; menu1.FindItem(dr["Parent_Menu"].ToString()).ChildItems.Add(mnu); } ..........etc