Copied to clipboard

Flag this post as spam?

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


  • IsabelChristensen 5 posts 35 karma points
    Feb 11, 2020 @ 16:30
    IsabelChristensen
    0

    Problem with nedsted content in separate partial views

    Hey! I am currently working with nested content, where i want to render my nested content in separate partial views. I have tried to use the same method as you can use in Umbraco7 just with some difference. My problem is, that I get this error when i am rendering "item" in my partial view. I need "item" to get access to my data.

    enter image description here enter image description here Anyone who can help?

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Feb 11, 2020 @ 16:53
    Matthew Wise
    0

    Hi Isabel

    At the top of the Layouts/Banner does your @inherits have UmbracoViewPage<IPublishedContent> if so it will need to be UmbracoViewPage<IPublishedElement>.

    This is due to nested content items needing to be an element type in V8

    Hope this helps

    Matt

  • IsabelChristensen 5 posts 35 karma points
    Feb 11, 2020 @ 17:36
    IsabelChristensen
    0

    Hey Matthew, Thanks for the answer, the error is gone now. But I don't understand why i cant see my banner on the website. This is how the partial view look like?

    enter image description here

    Do i really have to import var layouts = Model.Value<IEnumerable<IPublishedElement>>("content"); again in this view or?

  • Matthew Wise 271 posts 1373 karma points MVP 4x c-trib
    Feb 11, 2020 @ 17:48
    Matthew Wise
    100

    No in your partial it should be the banner you passed.

    feature banner may need to be IEnumerable<IPublishedContent> if the media picker can allow multiple to be selected in the CMS

  • IsabelChristensen 5 posts 35 karma points
    Feb 11, 2020 @ 17:51
    IsabelChristensen
    0

    I was just a stupid mistake. My alias is not "featuredBanner" but something else. I can see my banner now. Thanks alot for the help!

Please Sign in or register to post replies

Write your reply to:

Draft