Copied to clipboard

Flag this post as spam?

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


  • Aximili 177 posts 278 karma points
    Sep 05, 2014 @ 09:28
    Aximili
    0

    Razor: How to get a Document/Node by ID?

    In the sample code, this is how you get the Home page from a .cshtml file

        var homePage = CurrentPage.AncestorsOrSelf(1).First();

    Now, how do I get a specific page/node (not related to current page, eg. the News page) by its ID?

    And btw I'm wondering, what is the Type of the homePage in the above code? Is it a Node?

  • Jeavon Leopold 3042 posts 13382 karma points MVP 8x admin c-trib
    Sep 05, 2014 @ 09:48
    Jeavon Leopold
    100
    var myNode = Umbraco.Content(1234)
    

    Yes homePage it's a node

Please Sign in or register to post replies

Write your reply to:

Draft