Are you trying to display this on Parent 1 or from another node?
Did you only want to display this on Parent 1, but not Parent 2?
Here are some generic examples, but if you give me more info I can give you the exact code you need to target the right nodes.
@{
// Start from the home node
var homeNode = Model.Root();
}
@* Take anything under the home node that is visible *@
@foreach (var item in homeNode.Children.Where(x => x.IsVisible()))
{
}
@* Take the descendants of the home node with a document type alias of yourDocTypeAlias that is visible *@
@foreach (var item in homeNode.Descendants("yourDocTypeAlias").Where(x => x.IsVisible()))
{
}
@{
// Start from the Current Page
var CurrentPage = Model;
}
@* Take anything under the current page that is visible *@
@foreach (var item in CurrentPage.Children.Where(x => x.IsVisible()))
{
}
@* Take the descendants of the current page with a document type alias of yourDocTypeAlias that is visible *@
@foreach (var item in CurrentPage.Descendants("yourDocTypeAlias").Where(x => x.IsVisible()))
{
}
How to to get all nodes under a specific parent - Examine | Umbraco8
Hi all,
I have this structure :
Parent1
.Node1
.Node2
.Node3
.Node4
Parent2
.Node
.Node
.Node
.Node
I need to know, how to get all nodes that are under Parent1
so the result that i need is [node1,node2,node3,node4]
It would be appreciated if someone help me in this.
Which version of Umbraco are you using?
Are you trying to display this on Parent 1 or from another node?
Did you only want to display this on Parent 1, but not Parent 2?
Here are some generic examples, but if you give me more info I can give you the exact code you need to target the right nodes.
I've found a quick way to solve my question:
This code will get only nodes under a specific path.
is working on a reply...