Really? Wow, I never would''ve guessed that. Thanks for the reply Rodion.
I don't seem to be able to find anywhere either on the internet or in the library on my machine that tells me this sort of information. None of the methods have descriptions.
[Added by edit]: On second thoughts, if this is the case, what is the use of the optional parameter that lets you specify the alias of the document type you wish to retrieve? In my experience it only returns documents if you use the alias of the first document type, i.e. in my example it returns results if you use "News List" as the parameter, but not if you use "Text Page".
The parameterised overload should return all nodes of the type with a type alias passed. At least it's supposed to - I've actually never used this DataTable representation of content.
Hi Rodion, in my experience it doesn't do that. It only returns results if you use the alias of the first item in the list, therefore rendering the function useless. Perhaps this is a bug...
Wow, just had a huge mindf*ck when debugging a really old website (umbraco v4.0.3), which had to do with this weird behavior of the ChildrenAsTable method. Thanks for the explanation Rodion!
Confused by results from Node.ChildrenAsTable()
Hi,
I am relatively new to Umbraco and come from an ASP.NET programming background, therefore I am trying to use the API.
My website has 6 pages, producing the following document type structure:
---- Homepage
--------News List
--------TextPage
--------TextPage
--------TextPage
--------News List
If I set my Node variable to be equal to the Homepage, via the following hardcoded ID and then call ChildrenAsTable:
this seems to return a datatable with only two rows, i.e. the two pages of type "News List". I would expect it to have 5 rows, one for each child?
If I view RootNode.ChildrenAsList() then there are clearly 5 children, so I'm quite confused. Is this a known bug, or I am doing something wrong?
Thanks,
Jenni
Sorry, I forgot to mention my Umbraco version. I'm using 4.6.
Hi. It's not a bug. "GetChildrenAsTable" fills the datatable with the children of the same content type as the first child of the node has.
Really? Wow, I never would''ve guessed that. Thanks for the reply Rodion.
I don't seem to be able to find anywhere either on the internet or in the library on my machine that tells me this sort of information. None of the methods have descriptions.
[Added by edit]: On second thoughts, if this is the case, what is the use of the optional parameter that lets you specify the alias of the document type you wish to retrieve? In my experience it only returns documents if you use the alias of the first document type, i.e. in my example it returns results if you use "News List" as the parameter, but not if you use "Text Page".
The parameterised overload should return all nodes of the type with a type alias passed. At least it's supposed to - I've actually never used this DataTable representation of content.
Hi Rodion, in my experience it doesn't do that. It only returns results if you use the alias of the first item in the list, therefore rendering the function useless. Perhaps this is a bug...
Jenni
It only returns results if you use the alias of the first item in the list
I have just tried it - it looks to work ok nevertheless.
Wow, just had a huge mindf*ck when debugging a really old website (umbraco v4.0.3), which had to do with this weird behavior of the
ChildrenAsTable
method. Thanks for the explanation Rodion!is working on a reply...