private static bool TryFindActiveNode(SiteMapNode mainnode, string key, out SiteMapNode result) { TridionSiteMapProvider provider = (TridionSiteMapProvider)mainnode.Provider; SiteMapNode current = null; if (string.IsNullOrEmpty(key) || !provider.NodeDictionary.TryGetValue(key, out current)) { LoggerService.Warning("SiteMapNode '{0}' not found in TryFindActiveNode.", key); result = null; return(false); } TridionSiteMapNode currentT = (TridionSiteMapNode)current; if (currentT.Level < 3) // we are in the Home sg, no way to find out what the left menu should be { result = null; return(false); } while (currentT.Level > 3) { currentT = currentT.ParentNode as TridionSiteMapNode; } result = currentT; return(true); }
public static bool TryFindActiveNode(SiteMapNode mainnode, string structureGroupId, out SiteMapNode result) { TridionSiteMapProvider provider = (TridionSiteMapProvider)mainnode.Provider; if (!provider.NodeDictionary.TryGetValue(structureGroupId, out result)) { Trace.TraceWarning("SiteMapNode '{0}' not found in TryFindActiveNode.", structureGroupId); return(false); } else { return(true); } }