We created the attribute OnlyBreadCrumbMVCSiteMapNodeAttribute. We decorate any code that we need an 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; } }
There is also 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 as
[OnlyBreadCrumbMvcSiteMapNode("Upload Documents", "AssetDocuments")] public virtual ActionResult FileUpload(int assetId)
Downloading documents will be the title. AssetDocuments is the parent key
If you pass the third parameter, which sets the key for the node bundle itself
Graememiller
source share