I have an menu control with a definition that starts out so:
<asp:Menu ID="mnuDocs" runat="server" DataSourceID="SiteMapDataSource1"...
I want to be able to add items to the menu based on various circumstances, and have found some examples online. By way of testing the concept, I have tried code in the Page_Load like this:
MenuItem newItem = new MenuItem("Second Item");
newItem.NavigateUrl = "#SecondItem";
mnuDocs.Items.Add(newItem);
mnuDocs.Items.Add(new MenuItem("New Menu Item", "#NewMenuItem"));
This has no effect on the displayed menu, though inspecting the menu in debug shows the items are added. What I don't understand is that the items from the sitemap do not show up in the menu when I inspect it in debug, but only items from the sitemap are rendered on the page. What is it I am not understanding about how to go about this?