me thinks this should work if you just want to list all descendants (from what I assume looking at your output) regardless of nested structure
@{ var promoNode = new DynamicNode(<id of Promos node>); var descendants = promoNode.Descendants(); <ul> foreach(var descendant in descendants) { <li>@descendant.Name</li> } </ul> }
Is there a way to do it so that the ID of the node does not need to be input? For example, Self ? s there will be multiple Promo nodes with child pages.
Still not getting the right result. I can't seem to get the 3rd and 4th level items to appear under one nav (as in my example above). When I am on the 3rd level node (i.e. Promo 1 Details), it shows the child nodes but not itself. When I go to the 4th level node (i.e. About or Terms and Conditions), no items are returned.
Razor sidebar nav
Hi,
I need to create a sidebar nav but having a bit of trouble writing it with razor. My content structure is as follows:
- Home
-- Promos
--- Promo 1 Details
---- About
---- Terms and Conditions
What I am trying to do is produce a sidebar nav like the below for Promo 1 and for it's child pages
*Promo 1 Details
*About
*Terms and Conditions
Any tips? I know I can do this in XSLT but trying to use Razor instead
Using Umbraco 4.8.1
Cheers,
Bij
Hi Bijesh,
Here you go
HI,
me thinks this should work if you just want to list all descendants (from what I assume looking at your output) regardless of nested structure
Cheers,
/Dirk
Is there a way to do it so that the ID of the node does not need to be input? For example, Self ? s there will be multiple Promo nodes with child pages.
yup, use Model.Id (equivalent to $currentPage/@id)
Still not getting the right result. I can't seem to get the 3rd and 4th level items to appear under one nav (as in my example above). When I am on the 3rd level node (i.e. Promo 1 Details), it shows the child nodes but not itself. When I go to the 4th level node (i.e. About or Terms and Conditions), no items are returned.
- Home
-- Promos
--- Promo 1 Details <-- 3rd level
---- About <-- 4th level
---- Terms and Conditions<-- 4th level
Hope this makes sense?
is working on a reply...