I try to use MvcSiteMapProvider for breadcrumbs.
I have the following sitemap file:
<mvcSiteMap xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0"
xsi:schemaLocation="http://mvcsitemap.codeplex.com/schemas/MvcSiteMap-File-4.0 MvcSiteMapSchema.xsd">
<mvcSiteMapNode title="Home" controller="Home" action="Index" key="Index">
<mvcSiteMapNode title="About" controller="Home" action="About"/>
<mvcSiteMapNode title="Company List" controller="Company" action="Index" key="Company">
<mvcSiteMapNode title="Create company" controller="Company" action="Create" />
</mvcSiteMapNode>
</mvcSiteMapNode>
</mvcSiteMap>
and display it:
@Html.MvcSiteMap().SiteMapPath()
it works fine for pages "Create Company", "Company List" etc
then I want to add it for action with parameters:
[MvcSiteMapNode(Title = "Company Details", ParentKey = "Company", Key = "CompanyDetails")]
public ActionResult Details(int? id)
{
...
CompanyDetailVM model = mapper.Map<CompanyDetailVM>(company);
return View(model);
}
but it does not work, no show breadcrumbs at all. Where is a mistake?
Try to add
idroute parameter to the sitemap node: