I have a MVC project and I'm implementing a breadcrumb with the MVCSiteMapProvider.
My MVC.sitemap is the follow:
<mvcSiteMapNode title="Index" controller="Index" action="Index" key="Index">
<mvcSiteMapNode title="Parent" controller="Parent" action="View" key="Parent" >
<mvcSiteMapNode title="Child" controller="Child" action="View" />
</mvcSiteMapNode>
</mvcSiteMapNode>
I have added to the _layout view
@Html.MvcSiteMap().SiteMapPath()
I need to preserve the parameters to retrieve the correct item when I return to the parent item. To do this I added to the View action the annotation SiteMapPreserveRouteData:
[SiteMapPreserveRouteData]
public ActionResult View(Guid id)
Now, I can navigate using my breadcrumb.
The problem is that it only works with the first item. When I change the item, the breadcrumb disappears...
Sample: I navigate to the Parent p2 -> Child c1, and after I return to the Index and select the Parent p1, the View page of the parent doesn't show the breadcrumb.
It's not happening if I remove the annotation SiteMapPreserveRouteData, but the breadcrumb lost the id then..
What am I doing worng? Some idea?
Thanks