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 3074 posts 13632 karma points MVP 11x admin c-trib
    Sep 05, 2014 @ 09:48
    Jeavon Leopold
    100
    var myNode = Umbraco.Content(1234)
    

    Yes homePage it's a node

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies