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
Jignesh KumarPosted Aug 11, 2021, 4:47 AM
Ganesan CPosted Aug 10, 2021, 2:30 PM
Sachin SinghPosted Aug 10, 2021, 12:38 PM