Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Sep 19, 2019 @ 14:50
    Tim
    0

    How to get the overall page ID if passing in another node as a model

    I have a partial that I pass a settings node to. The partial inherits from UmbracoViewPage

    Inside the view, I want to get the current PAGE id for the outer page that's being rendered. Everything I can find seems to indicate that I should use:

    @Umbraco.AssignedContentItem
    

    However, in partials where I have passed in a different node, the AssignedContent item is what I passed into the view, not the outer page. Am I using the wrong method? Obviously you used to be able to get the PublishedContentRequest and get it from there......

    Does anyone know how to achieve this V8?

  • Anders Bjerner 487 posts 2996 karma points MVP 8x admin c-trib
    Sep 19, 2019 @ 15:54
    Anders Bjerner
    101

    Similar to how UmbracoViewPage has an Umbraco property, there is also an UmbracoContext property. So I think the following line is what you're looking for:

    @UmbracoContext.PublishedRequest.PublishedContent
    
  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Sep 25, 2019 @ 08:17
    Tim
    0

    Thanks Anders, that's exactly what I was looking for!

  • 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