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
If I use ApplicationContext.Current.Services.ContentService.GetChildrenByName(NodeId, "NodeName");
It can only find nodes directly under NodeId.
What options have I got for finding nodes by name in the tree at any level under NodeId?
Are you doing this on the front or back end of the site? If you're in the front end, DON'T use the ContentService, as it hits the database, use the ContentCache instead, which will allow you to do the type of query that you're after!
Can you give me a bit of information about where in your application you're trying to query the nodes (front end or back office etc), and I'll see if I can give you some example code!
I am using it on the front end, example code would be welcome.
I'll assume you're using a Razor Macro or MVC view, in which case, something like this should do the trick for you:
Will get you all of the descendants of the node with the id you pass in with the document type alias that you pass in to the Descendants function.
If you want to get the nodes by the actual text name of the nodes, you could try:
Umbraco.TypedContent(NodeId).Descendants().Where(a => a.Name = "NODE NAME HERE")
There's some documentation on querying content on the front end here:
Hope that helps!
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted