In this example we will use a custom attribute to hide some SiteMapNodes from a Menu control.
You can create custom attributes in a sitemap file easily as follows:
On the SearchResults.aspx node there is a custom attribute called “IsMenuVisible”. The “IsMenuVisible” attribute has been set to “False” since we do not want this node showing in the nav menu.
This attribute can easily be accessed from the MenuItemDataBound event in the codebehind as follows:
In the above example we cast “e.Item.DataItem” back to a SiteMapNode and access the custom attribute through it’s string index. The remaning code is used to remove it from the Menu