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
hi,
this code is working fine:
node.Children.Where("disable != true").Where("Level <= maxLevels", values);
(BTW, node is from type dynamic)
but it get only the childrens. i want also to get the grand-childrens, etc.
i know that i need to use with Descendants, but i cant make it work with the above WHERE statment.
thanks.
anybody?
thanks
You should just be able to replace Children with Descendants()
If that doesn't work, make sure to get umbraco.RazorEngines.dll from a recent nightly and put it in your /bin folder.
thanks, that solved it.
the problem was the syntax.
while this code is working:
var items = node.Children.Where("disable != true");
if figured it up that this one should work also:
var items = node.Descendants.Where("disable != true");
but it didnt.. because of the missing brackets after Devendants. this is the working version:
var items = node.Descendants().Where("disable != true");
Yes, I understand this can be a bit confusing. I'm not sure why Children is not a method, but Descendants is. Glad it solved your problem though!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
how to use node.Descendants() and Where()
hi,
this code is working fine:
(BTW, node is from type dynamic)
but it get only the childrens. i want also to get the grand-childrens, etc.
i know that i need to use with Descendants, but i cant make it work with the above WHERE statment.
thanks.
anybody?
thanks
You should just be able to replace Children with Descendants()
If that doesn't work, make sure to get umbraco.RazorEngines.dll from a recent nightly and put it in your /bin folder.
thanks, that solved it.
the problem was the syntax.
while this code is working:
if figured it up that this one should work also:
but it didnt.. because of the missing brackets after Devendants.
this is the working version:
var items = node.Descendants().Where("disable != true");
Yes, I understand this can be a bit confusing. I'm not sure why Children is not a method, but Descendants is. Glad it solved your problem though!
is working on a reply...