adding menuitems

J

Jeff

hey

asp.net 2.0

I want to add a menu item to a menu on my webpage programatically. I've
tryed using the code below, but it doesn't add the menu item to the menu.

MenuItem menuItem = new MenuItem("Menu item text", "menuitemvalue",
"imageurl", "navigateurl");
Menu menu = (Menu) lvSidebar.FindControl("mnuSidebar");
menu.Items.Add(menuItem);

About my code:
lvSidebar is a Loginview
mnuSidebar is placed within the LoggedInTemplate
"MenuItem menuItem = new MenuItem("Menu item text", "menuitemvalue",
"imageurl", "navigateurl");", works
"Menu menu = (Menu) lvSidebar.FindControl("mnuSidebar");" works, FindControl
finds the mnuSidebar

Any suggestions to why my code don't add a menu item the web page?

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top