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
Hello Experts,
Document Structure
I have a nested content editor with a document type that has a two text string fields and one repeatable textstring field.
The document type that has a nested content editor is a child of another document type.
My Question
How do I render the nested content type in a parent document type template?
Here is where I am
@foreach (ContentModels.DTWithNestedEditor _document in Model.Content.Children) { @_document .Name //Display nested component values //Single textstring //Repeatable teststring }
Hi Umbraco Beginner
You could do something like this:
@foreach(ContentModels.DTWithNestedEditor _document in Model.Content.Children) { @_document.Name if(_document.NestedContentProperty != null) { foreach(NestedContentType nestedContentType in _document.NestedContentProperty) { <div>@nestedContentType.StringProperty1</div> <div>@nestedContentType.StringProperty2</div> @foreach(var stringVal in nestedContentType.RepeatedStringProperty) { <div>@stringVal</div> } } } }
Give that ago and see if it works for you :-)
Nik
Thanks. It works
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Nested Content Rendering from a parent page
Hello Experts,
Document Structure
I have a nested content editor with a document type that has a two text string fields and one repeatable textstring field.
The document type that has a nested content editor is a child of another document type.
My Question
How do I render the nested content type in a parent document type template?
Here is where I am
Hi Umbraco Beginner
You could do something like this:
Give that ago and see if it works for you :-)
Nik
Thanks. It works
is working on a reply...