Click here to Skip to main content
15,912,400 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got some menus in my application built using
ASP.NET
<asp:Menu>

In that, I got STYLES as default and under STYLES, I need to load sub menus like this?
C#
STYLES
1
2


The code I used to load the submenu:
C#
MenuItem root = new MenuItem("STYLES");
            for(int i=0;i<dt.Tables[0].Rows.Count;i++)
            {
                root.ChildItems.Add(new MenuItem(dt.Tables[0].Rows[i]["Season"].ToString()));
            }


But this code is not working.. The submenus are not loaded. What would be the error ???
Posted

1 solution

See this Simple, But descriptive example..

How To Create Multi Level Menu Dynamically Using C# in ASP.Net[^]
 
Share this answer
 
Comments
Sriram Ramachandran 26-Aug-14 2:48am    
I saw this reference already but I've also few other menus and am just making 1 menu as dynamic

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900