Copied to clipboard

Flag this post as spam?

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


  • Linden Koppejan 15 posts 165 karma points
    Feb 09, 2023 @ 15:48
    Linden Koppejan
    0

    Umbraco Block Grid - Get Parent of BlockGridArea

    Hello there,

    I'm using the Umbraco Block Grid Editor for the first time.

    Now im in the "area.cshtml" and the Model is BlockGridArea. Sadly there is no function to get the Parent of the Model like for IPublishedContent.

    I need the Parent to determend if I render the blocks in a grid or a different view.

    Does anyone know if that's possible?

    Thanks for letting me know,

    Linden Koppejan

  • Huw Reddick 1932 posts 6722 karma points MVP 2x c-trib
    Feb 09, 2023 @ 16:03
    Huw Reddick
    0

    Hi Linden,

    Not sure exactly what you are trying to accomplish, surely the whole point of using the blockgrid is to render something in a grid.

  • Darren Hunter 146 posts 238 karma points
    20 days ago
    Darren Hunter
    0

    Did you find a solution for this,

    I have 1 Umbraco instance with 3 sites in it, all the sites use the generic area.cshtml and areas.cshtml files.

    But depending on the site that been render it Needs to handle the block grid differently for adding image as back ground and bg coolers ect.

  • Afreed 86 posts 383 karma points
    19 days ago
    Afreed
    0

    Hi Darren,

    If you are trying to "adding image as back ground and bg coolers ect" then you could use Settings tab for the area item or the entire layout block. If its still not enough just edit the area.cshtml or the areas.cshtml according to your needs.

  • Darren Hunter 146 posts 238 karma points
    19 days ago
    Darren Hunter
    0

    I know I can do that, What I need to be able to do is work out which of the Sites is been render when area and areas are been called.

    At the moment I am doing that by using a specific settings on the RET ect, but that not a good way of doing it as I have to remember in the future to set the correct settings type.

    I like to be able to get the sites parent node id.

  • Afreed 86 posts 383 karma points
    16 days ago
    Afreed
    0

    You could access the assigned content item like this and get the parent if that's what you are looking for

    var content = Umbraco.AssignedContentItem;
    
Please Sign in or register to post replies

Write your reply to:

Draft