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,
I'm fairly new to Umbraco 7, so I apologize if this is staring the me in the face.
I have a content folder that I'd like to get all of the content items underneath of this within a template. What is the best way to do this?
The template I am using for the content folder is inheriting from Umbraco.Web.Mvc.UmbracoTemplatePage.
Thanks!
Hi Victor,
You can use this code to get typed objects:
IEnumerable<IPublishedContent> descs = Model.Content.Descendants(); // returns all descendants from all levels under content node IEnumerable<IPublishedContent> children = Model.Content.Children; // returns children only under content node
for more information https://our.umbraco.org/Documentation/Reference/Querying/IPublishedContent/Collections
Regards, Ivan
Thanks Ivan! That's super helpful
Glad to help you! welcome to Umbraco :)
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get all content childer from folder
Hello,
I'm fairly new to Umbraco 7, so I apologize if this is staring the me in the face.
I have a content folder that I'd like to get all of the content items underneath of this within a template. What is the best way to do this?
The template I am using for the content folder is inheriting from Umbraco.Web.Mvc.UmbracoTemplatePage.
Thanks!
Hi Victor,
You can use this code to get typed objects:
for more information https://our.umbraco.org/Documentation/Reference/Querying/IPublishedContent/Collections
Regards, Ivan
Thanks Ivan! That's super helpful
Glad to help you! welcome to Umbraco :)
Regards, Ivan
is working on a reply...