/// <summary> /// Finds the parent node of the specified node /// </summary> /// <param name="siteMapNode"></param> /// <param name="siteMap"></param> /// <returns></returns> public static SiteMapNode GetParentNode(this SiteMapNode siteMapNode, SiteMap siteMap) { foreach (var node in siteMap.Nodes) { return FindParentNode(node, siteMapNode); } return null; }
public static SiteMapNode FindSiteMapNodeFromMvcRoute(SiteMap siteMap, IDictionary<string, object> values, RouteBase route) { var routes = RouteTable.Routes; // keyTable contains every node in the SiteMap foreach (var node in siteMap.GetKeyToNodeDictionary()) { if (node.MatchesRoute(values)) { return node; } } return null; }