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
Hi guys,
What would be the best way of accessing a child node at a certain level instead of making use of umbracoRedirect with the following structure
ContentHome Node 1 -- Sub Node 1 --- Sub Sub Node 1
If a want Node 1 to get the url of Sub Sub Node 1 here. did try something like
@navi.Children.Next().First().Url
Hey Fuji,
Are they all the same DocType?
Rich
If not, you need to use 'Level'
Hi Rich,
Yes both -- Sub Node 1 & --Sub Sub Node 1 has the same DocType.
@foreach(dynamic navi in Model.AncestorOrSelf(2).Descendants("DocType").Where("Level > 4")){@navi.Url}
However here i would only need the first Url from each level 5
@navi.First().Url not working
Hi Fuji
Does .Down() work on Level?
If so @navi.Down(2) should give you sub-sub-node. If not then .Down().Down(), but I think the (2) should work.
Regards
Gary
Hi Gary,
Thanks for the reply. Tried both but aint working.
Just had a play, ok, Down() gives the first child, .Down().Next() gives the second child, like you say .Down(2) gives error.
using @CurrentPage.Down(), just for reference.
The answer is here somewhere
http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5.aspx
Think it is a case of .Down(1).Down(), if not something like that.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Jump to nth Node
Hi guys,
What would be the best way of accessing a child node at a certain level instead of making use of umbracoRedirect with the following structure
Content
Home
Node 1
-- Sub Node 1
--- Sub Sub Node 1
If a want Node 1 to get the url of Sub Sub Node 1 here. did try something like
Hey Fuji,
Are they all the same DocType?
Rich
If not, you need to use 'Level'
Rich
Hi Rich,
Yes both -- Sub Node 1 & --Sub Sub Node 1 has the same DocType.
However here i would only need the first Url from each level 5
Hi Fuji
Does .Down() work on Level?
If so @navi.Down(2) should give you sub-sub-node. If not then .Down().Down(), but I think the (2) should work.
Regards
Gary
Hi Gary,
Thanks for the reply. Tried both but aint working.
Hi Fuji
Just had a play, ok, Down() gives the first child, .Down().Next() gives the second child, like you say .Down(2) gives error.
using @CurrentPage.Down(), just for reference.
The answer is here somewhere
http://umbraco.com/follow-us/blog-archive/2011/3/13/umbraco-razor-feature-walkthrough-part-5.aspx
Think it is a case of .Down(1).Down(), if not something like that.
Regards
Gary
is working on a reply...