Child items in sitemap

Topics: User Forum
Jan 22, 2007 at 2:24 AM
How do you had child links to the sitenode? So when you add a new module you add the sitenode in the shell and it will show up in the masterpage, but if I want to display a link to another view in the same module how can i add that link as a child to the one i added originally in the sitenode in the shell?

Jan 22, 2007 at 8:52 AM
You need to register the pages (views) that should be the targets displayed in the site map at module initialization time. In the MyModuleInitializer class you should see a definition like the following;

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("My Module First Page", "~/MyModule/Default.aspx", "First Page");

// TODO: register other site map nodes that Booking module might provide

So to add a second page (as a child link of the one above) you would add the following lines;

SiteMapNodeInfo newNode = new SiteMapNodeInfo("My Module Second Page", "~/MyModule/Second.aspx", "Second Page");
siteMapBuilderService.AddNode(newNode, moduleNode);

If you wanted to add it to the root node, on a level with the first page, just omit the "parent node" argument in the call to AddNode.

Hope that helps.

Jan 22, 2007 at 2:58 PM
Thanks I found it!!