Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Simon Dingley 1474 posts 3431 karma points c-trib
    Jun 20, 2011 @ 13:51
    Simon Dingley
    0

    Problem Accessing Descendant Nodes

    Any reason why the following returns NewsItem nodes as expected:

    Model.AncestorOrSelf(1).Descendants("NewsItem")

    But the following does not even though it is being used on a node that is the parent to a bunch of "NewsItem" nodes?

    Model.Descendants("NewsItem")

    Am I missing something obvious?

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Jun 20, 2011 @ 14:08
    Sebastiaan Janssen
    0

    Have you tried this:

    Model.DescendantsOrSelf("NewsItem")
  • Simon Dingley 1474 posts 3431 karma points c-trib
    Jun 20, 2011 @ 14:14
    Simon Dingley
    0

    No luck with that either. If I step through the code in Visual Studio it shows the node as having no children despite the fact there are 3.

    I'm wondering if perhaps it may be related to the AutoFolders package in some way.

  • Sebastiaan Janssen 5058 posts 15520 karma points MVP admin hq
    Jun 20, 2011 @ 14:17
    Sebastiaan Janssen
    1

    Hmmm, have a look in the umbraco.config to see make sure that there are actually children, you may not be seeing the correct structure in the content tree?

    Other than that, try to see what Model.Id / Model.Name is to make sure that you're trying to access the correct node.

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Jun 20, 2011 @ 20:54
    Simon Dingley
    0

    Thanks Sebastiaan. I should have checked the umbraco.config first. For some reason the contents were not in the correct order, I did republish all and the order was restored and everything behaved as expected.

    I suspect it may be possibly be related to AutoFolders and it's process of creating folders and moving the nodes, I guess if they are not republished once moved their location in the XML file will not be updated.

Please Sign in or register to post replies

Write your reply to:

Draft