Adding Details/Edit sub-items in sitemap

Mar 6, 2011 at 3:32 PM

I have quite a special situation, although in MVC it might not be so special after all...

This is how my sitemap looks right now


<?xml version="1.0" encoding="utf-8" ?>
<mvcSiteMap xmlns="" enableLocalization="true">
    <mvcSiteMapNode title="Home" controller="Home" action="Index" changeFrequency="Always" updatePriority="Normal">
        <mvcSiteMapNode title="Projecten" controller="Projecten" action="Index" key="projecten">
            <mvcSiteMapNode title="Details" action="Details" dynamicNodeProvider="MVC2_NASTEST.ProjectenDynamicNodeProvider, MVC2_NASTEST" visibilityProvider="MVC2_NASTEST.ProjectVisibilityProvider, MVC2_NASTEST">
                <mvcSiteMapNode title="Aanpassen" controller="Projecten" action="Edit" />

                <mvcSiteMapNode title="Details" action="Details" controller="Modules" dynamicNodeProvider="MVC2_NASTEST.ModulesDynamicNodeProvider, MVC2_NASTEST">
                    <mvcSiteMapNode title="Details" action="Details" controller="Reeksen" dynamicNodeProvider="MVC2_NASTEST.ReeksenDynamicNodeProvider, MVC2_NASTEST" />

            <mvcSiteMapNode title="Nieuw" controller="Projecten" action="Create" />

        <mvcSiteMapNode title="Vragen" controller="ModuleVraag" />
        <mvcSiteMapNode title="Aanbod" controller="Aanbod" />
        <mvcSiteMapNode title="Admin" controller="Admin" action="Index">
            <mvcSiteMapNode title="Evaluaties" controller="Evaluatie" action="Index" />
            <mvcSiteMapNode title="Gebruikers" controller="Users" action="Index" />
            <mvcSiteMapNode title="Helpboxen" controller="Helpbox" action="Index" />
            <mvcSiteMapNode title="ONAS aanbieders" controller="ONASAanbieder" action="Index" />
            <mvcSiteMapNode title="Nieuws" controller="Nieuws" action="Index" />
        <mvcSiteMapNode title="Aanmelden" controller="Account" action="LogOn" />

 So i have an Index view named Projecten. this has a list of Projecten. I generate the list in the sitemap dynamically.
A Project has modules and a module has reeksen. This is getting a deep tree but ok.
For each project I have a details view, an Edit and a Links view.
the same for Modules and Reeksen.

First problem: Now the breadcrumbs only show the project when i am in the Details view. How do i fix it that it also would show that in the Edit and Links view.
In my sitemap, I atually want to see a project (could be non clickable, could be clickable to the Details page) and for each project i want to see 3 subitems. Details, Edit and Links.

how would i do that?

Second problem: When someone sees the Details page of a Module, it should show Home>Project>AProject>Modules>ThisModule
This works when the url looks like this: /Modules/Details/1?projID=5 but not when the url looks like this: /Modules/Details/1 even though a Module is always under 1 project. How do i fix that?

thanks in advance :)
Mar 25, 2011 at 10:04 PM

For 1: If you don't generate a menu and only use breadcrumbs, go with the approach in 2

For 2: In your action method, modiy SiteMap currentnode and its parent and parent.parent and .... to reflect the correct path.