views:

63

answers:

0

Almost a dupe of this: http://stackoverflow.com/questions/12297/how-can-i-remove-nodes-from-a-sitemapnodecollection

In fact, I used that answer after coverting the code to c# but I end up with an IEnumerable< SiteMapNode > result which wont bind to the sitemenu control. Here's the code:

ASPxSiteMapDataSource sitemap = new ASPxSiteMapDataSource();
sitemap.LoadFromFile("Navigation.sitemap");

SiteMapNodeCollection smnd = sitemap.Provider.RootNode.GetAllNodes();
var nodesFiltered = (smnd.OfType<SiteMapNode>().Where(collection => collection.Title != "RemoveMe"));
rootMenu.DataSource = nodesFiltered;
rootMenu.DataBind();  

I get "It must be either support IHierarchicalEnumerable or IHierarchicalDataSource" as the error. For the record I am using the DevExpress SiteMapDataSource and Menu.

Is there some way to covert nodesFiltered to IHierarchicalEnumerable or a better way to filter the SiteMapNodeCollection so that I end up with something that will bind to the menu?