Child items in sitemap

Topics: Web Client Software Factory, User Forum
Mar 22, 2007 at 10:17 AM
Edited Mar 22, 2007 at 10:18 AM
This is similar to a prvious post, but different!
I would like to add a Node in the sitemap using the shell init, then some of my modules add themselves as children to the original node. E.g.
Create                         - Added using the Shell Module
 - Child1                      - Added in ChildOne module
 - Child2                      - Added in ChildTwo module
 - Child3                      - Added in ChildThree module
Admin                          - Added using the Shell Module
In the Child1, Child2 & Child3 modules, how do I get a instance of the "Create" node to add the children?
Mar 22, 2007 at 1:24 PM
Edited Mar 22, 2007 at 1:26 PM
In your child module's "RegisterSiteMapInformation" method:

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
ReadOnlyCollection<SiteMapNodeInfo> rootChildren = 
SiteMapNodeInfo createNode = null;
foreach (SiteMapNodeInfo rootChild in rootChildren)
  if (rootChild.Key == "Create")
    createNode = rootChild;
SiteMapNodeInfo child1Node = new SiteMapNodeInfo(
  "Child1", "~/Modules/Child1/Default.aspx", 
  "Child 1", "Child 1");
siteMapBuilderService.AddNode(child1Node, createNode);
Mar 26, 2007 at 10:12 AM
Worked a treat