Skip to content

MvcSiteMapProvider renders wrong level if requested level is “empty” #348

@NightOwl888

Description

@NightOwl888

Issue originally reported on StackOverflow.

I currently render two levels of menu using the method

@Html.MvcSiteMap().Menu(2,1,true)

for the 2nd level.

What I THINK I'm saying in this case is "show me all level 2 nodes that are related to the current path". The last param is "allowForwardSearch" and I don't know what that means, I just know that if I don't set it to true, I get nothing rendered.

As it is, this renders the 2nd level menu just fine UNLESS all of the 2nd level nodes are filtered out via security/visibility filters which would leave an empty list of nodes for the 2nd level. If the expected result is NO 2nd level nodes, then it renders 1st level nodes instead. Which winds up duplicating items from the 1st level menu. I would expect that it would just render nothing, but that's not the case.

Is this a bug, or do I need to use a specific override (there's 80!) to get it to NOT revert to showing me 1st level nodes when I ask for 2nd level nodes.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions