c# - How to hide MvcSiteMapNode from menu but not breadcrumbs? -


i have page don't want showing in menu. however, when on page, do want show in breadcrumbs.

i'm trying isitemapnodevisibilityprovider class, can't figure out how determine whether provided sitemapnode argument inside menu or breadcrumbs.

how do this?

you can test html helper calling visibility provider checking "htmlhelper" element of sourcemetadata parameter. parameter passed visibility provider automatically.

the names used type's fullname (the qualified name without assembly name).

public class mynodenotonmenuvisibilityprovider     : sitemapnodevisibilityproviderbase {     public override bool isvisible(isitemapnode node, idictionary<string, object> sourcemetadata)     {         if (sourcemetadata.containskey("htmlhelper") && sourcemetadata["htmlhelper"].tostring().equals("mvcsitemapprovider.web.html.menuhelper"))         {             if (node.key == "mynode")             {                 return false;             }         }         return true;     } } 

in v4, can pass custom information through html helper using sourcemetadata, , can test custom information in custom visibility provider.

@html.mvcsitemap().menu(new { myinfo = "something" }) 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -