We created an OnlyBreadCrumbMVCSiteMapNodeAttribute. We decorate any code we want the attribute
public class OnlyBreadCrumbMvcSiteMapNodeAttribute : MvcSiteMapNodeAttribute
{
public OnlyBreadCrumbMvcSiteMapNodeAttribute(string title, string parentKey)
{
Title = title;
ParentKey = parentKey;
VisibilityProvider = typeof(BreadCrumbOnlyVisibilityProvider).AssemblyQualifiedName;
}
public OnlyBreadCrumbMvcSiteMapNodeAttribute(string title, string parentKey, string key)
{
Title = title;
Key = key;
ParentKey = parentKey;
VisibilityProvider = typeof(BreadCrumbOnlyVisibilityProvider).AssemblyQualifiedName;
}
}
Also have a visibilty provider
public class BreadCrumbOnlyVisibilityProvider : ISiteMapNodeVisibilityProvider
{
public bool IsVisible(SiteMapNode node, HttpContext context, IDictionary<string, object> sourceMetadata)
{
if (sourceMetadata["HtmlHelper"] == null || (string)sourceMetadata["HtmlHelper"] == "MvcSiteMapProvider.Web.Html.SiteMapPathHelper")
{
return true;
}
return false;
}
}
Use like
[OnlyBreadCrumbMvcSiteMapNode("Upload Documents", "AssetDocuments")]
public virtual ActionResult FileUpload(int assetId)
Upload Documents will be breadcrumb title. AssetDocuments is the Parent Key
If you pass the 3rd parameter, that sets a key of the breadcrumb node itself
siteMapNodeVisibilityProvider="MvcSiteMapProvider.FilteredSiteMapNodeVisibilityProvider, MvcSiteMapProvider"
in web.config? It is working for me – Impotent