Copied to clipboard

Flag this post as spam?

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


  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 22, 2011 @ 13:10
    Jeavon Leopold
    0

    NodesById or NodeById

    Hello,

    I have been trying to use Library.NodesById(2323).Descendants() as indicated in Gareths post here http://umbraco.com/follow-us/blog-archive/2011/9/22/umbraco-razor-feature-walkthrough%E2%80%93part-8.aspx but get the following error:

    Error loading Razor Script [RAZOR]BoxNation-GetBoxersList.cshtml
    'umbraco.MacroEngines.DynamicNodeList' does not contain a definition for 'Descendants'

    Switch to Library.NodeById and everything is fine?

    I am using standard Umbraco 4.7.1 Anyone else seen this behaviour, maybe a bug?

    Thanks

    Jeavon

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Nov 22, 2011 @ 13:17
    Sebastiaan Janssen
    1

    Might've been a typo in the blogpost but the two serve a completely different purpose. The pluralized version is for getting a list of DynamicNodes and the other version just gets a single dynamicnode. So, use NodeById if you want 1 node, NodesById if you need more of them.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 22, 2011 @ 13:37
    Jeavon Leopold
    0

    Ah ha, that makes more sense. Re-reading the blog post, it is quite confusing! Interestingly NodesById doesn't feature on the Razor cheatsheet at all.

    Thanks Seb!

Please Sign in or register to post replies

Write your reply to:

Draft