We're trying to find an efficent way to get all of the nodes (children) of a node that have a specific property we have created and designated in its template. Essentially, we have a "true/false" property that users can check/uncheck, and we want to gather all nodes that have that value checked.
Any simple with (with or without Linq) to do this? We're currently attempting to this in .net... but we're open to suggestions.
This is what I got so far... but there has to be a more effecient way to do this... without the recursive for loop...
How do I get all nodes based on a Property Value
Greetings all!
We're trying to find an efficent way to get all of the nodes (children) of a node that have a specific property we have created and designated in its template. Essentially, we have a "true/false" property that users can check/uncheck, and we want to gather all nodes that have that value checked.
Any simple with (with or without Linq) to do this? We're currently attempting to this in .net... but we're open to suggestions.
This is what I got so far... but there has to be a more effecient way to do this... without the recursive for loop...
private void GetChildrenOfNodeWithCalendarEnable(Node node, string propertyName, bool propertyValue)
{
foreach (Node child in node.Children)
{
if (Convert.ToBoolean(child.GetProperty(propertyName).Value) == propertyValue)
{
this.allNodes.Add(child);
}
if (child.Children.Count > 1)
{
this.GetChildrenOfNodeWithCalendarEnable(child, propertyName, propertyValue);
}
}
}
Let me know? Best wishes, and thanks in advance!!!
Greg
Hi Greg,
Here is an alternative way: http://our.umbraco.org/forum/developers/xslt/11304-NodeFactory.
Cheers,
Sascha
is working on a reply...