Hi,
You paste your sitemap as a image, so I cannot use it to have a test, I will post my test code entirely.
1. The sitemap:
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0">
<siteMapNode title="Parts" url="~/Parts/Default.aspx">
<siteMapNode title="Part List" url="~/Menu/Cases/Cases/remove/Default.aspx" />
<siteMapNode visible="false" title="Part Details" url="~/Parts/PartDetails.aspx"/>
<siteMapNode title="Search Parts" url="~/Parts/PartSearch.aspx"/>
</siteMapNode>
</siteMap>
2. The mene code:
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" CssClass="menu"
BackColor="#FFFBD6" DynamicHorizontalOffset="2"
Font-Names="Verdana" Font-Size="12px"
ForeColor="#990000" StaticSubMenuIndent="10px"
ondatabound="Menu1_DataBound" >
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<asp:SiteMapPath ID="SiteMapPath1" runat="server">
</asp:SiteMapPath>
3. The codebehind:
protected void Menu1_DataBound(object sender, EventArgs e)
{
//get the childnodes of the rootnode
MenuItemCollection mic = this.Menu1.Items[0].ChildItems;
//clear the items of the menu
this.Menu1.Items.Clear();
// add the items for the menu control
for (int i = 0; i < mic.Count;i++ )
{
MenuItem mi = mic[i];
this.Menu1.Items.Add(mi);
}
}
So you can create a new application to have a test by using above code. If your problem cannot be solved, you can post the details of your code, so we can use it to repro your problem on our local, which is helpful.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Yours sincerely,
Amanda Wang
Microsoft Online Community Support