Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I've got a setup like the following.
-root --about ----info ------moreinfo
Ok, my breadcrumb looks like this:
<ul> <li><a href="/?mobile=1">Home</a></li> @foreach(var level in @Model.Ancestors(2)) { <li><a href="@level.Url?mobile=1">@level.Name</a></li> } <li>@Model.Name</li> </ul>
Ths is what gets returned: Home | about | moreinfo
Is there some reason that info is being skipped in my example? I was assuming that the Ancestors would return all the parents.
It's not actually being skipped, "2" is the index of your ancestor, so you're only getting ancestor number 2. Why not use ancestors without the number?
Or, if you want to filter by level, do something like:
@Model.Ancestors().Where("Level > 2")
Thanks, that's exactly what I needed.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Ancestors(2) not returning all the Ancestors (4.7RC)
I've got a setup like the following.
Ok, my breadcrumb looks like this:
Ths is what gets returned: Home | about | moreinfo
Is there some reason that info is being skipped in my example? I was assuming that the Ancestors would return all the parents.
It's not actually being skipped, "2" is the index of your ancestor, so you're only getting ancestor number 2. Why not use ancestors without the number?
Or, if you want to filter by level, do something like:
@Model.Ancestors().Where("Level > 2")
Thanks, that's exactly what I needed.
is working on a reply...