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
I need to get all nodes of a certain doctype that are children of the current page.
I've not seen how to do this on Umbraco 8 and the way I used to do it in 7 is not applicable here.
Is there a precise way of doing this?
For now, I've been retrieving all children and then checking one by one for their doctype, not efficient at all.
Have you tried ChildrenOfType ?? extension method on IPublishedContent
var childrenOfBlogType = Model.ChildrenOfType("blogPage");
I was actually able to get everything using this:
var selection = Model.Descendants().Where(x => x.IsDocumentType("xxx")).Where(y => y.IsVisible());
Descendants... will pull all descendants into memory eg those below the children... (but sounds like in your circumstance there aren't any!)
so be careful, in some circumstances you might find it's much more efficient to just use ChildrenOfType... and then you'll get only the children!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted