API
Version 7.x > API > TreeProvider Questions View modes: 
User avatar
Member
Member
joshuar-theprimacy - 9/17/2013 1:59:23 PM
   
TreeProvider Questions
I am using the SelectNodes method to return child nodes where I use the "/%" string. By using "/%" it seems like all children nodes(even nested children) are being returned. How would I retrieve only the immediate children?

User avatar
Member
Member
kentico_sandroj - 9/17/2013 5:12:46 PM
   
RE:TreeProvider Questions
Hello,

You would use an overload that also specifies a WHERE condition which you can use to filter out unwanted documents. Would this approach work for you?

Best Regards,
Sandro

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 9/18/2013 1:16:07 PM
   
RE:TreeProvider Questions
The WHERE condition might work ok, although I'd suggest using the MaxRelativeLevel.
DataSet docs = tree.SelectNodes(CMS.CMSHelper.CMSContext.CurrentSiteName, "/API-Example/%", "en-us", false, "CMS.MenuItem", "", "", 1);
There are 12 overloads to the SelectNodes() method, I'm positive you can find one which will work.

User avatar
Member
Member
Swainy - 9/20/2013 4:04:08 AM
   
RE:TreeProvider Questions
Hi Joshuar,

You can use max relative levels to set the relative level to be returned (1 level deep).

To get direct decendants (anything under the current page) you can use ./% and for anything under the parent you could ../% other examples are /{0}/% which will render from the top level according to where you are in the tree and /{0}/{1}/% will render the second level down according to where you are in the tree.

Thanks,

Matt