Hi Lata,
Have a these columns in your datatable (here menudt is my Datatable) MENU_ID,MENU_NAME,PAGE_NAME,PARENT_MENU_ID,MENU_LOCATION
Try to use this following codes,
Here, menuBar is my MasterPage's Menu control.
DataRow[] drowpar = menudt.Select("ParentID=" + 0);
foreach (DataRow dr in drowpar)
{
menuBar.Items.Add(new MenuItem(dr["MenuName"].ToString(),
dr["MenuID"].ToString(),""));
}
foreach (DataRow dr in menudt.Select("ParentID >" + 0))
{
MenuItem mnu = new MenuItem(dr["MenuName"].ToString(),
dr["MenuID"].ToString(),
"", dr["MenuLocation"].ToString());
menuBar.FindItem(dr["ParentID"].ToString()).ChildItems.Add(mnu);
}
Regards,
BlueSathish