1
votes

I'm wondering how I can get a Node recursively inside my Layout.cshtml in umbraco.

I have a couple of properties on my Homepage DocumentType which are content pickers, and need to access the properties recursively on my masterpage. How can i do this?

I know how to do this with a normal field by calling Umbraco.Field("prop", recursive: true)

I hope someone can help me.

1
So you want to loop every selected items in the content picker, and then select properties from every node in the loop?Morten OC

1 Answers

1
votes

Pretty similar really:

Model.Content.GetPropertyValue("myProperty", true)

or

@CurrentPage.GetPropertyValue("myProperty", true)

This is lesser known but also works

@CurrentPage._myProperty

I assume you know how to get the node from the Content picker?

var nodeId = Model.Content.GetPropertyValue("testRecursive", true);
var node = Umbraco.TypedContent(nodeId);