Copied to clipboard

Flag this post as spam?

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


  • Allan Kirk 9 posts 99 karma points c-trib
    Feb 22, 2019 @ 06:09
    Allan Kirk
    0

    Grid in composition

    I want to setup a new project using compositions for many things, so I can reuse cross pages. I have setup a composition with a Grid Editor, and added that composition to a page, but I cannot get the grid to render.

    After some digging, I found that I have to create a partial view to render compositions, and I ended up with this:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<ContentModels.IContentComposition>
    @using ContentModels = Umbraco.Web.PublishedModels;
    
    @Html.GetGridHtml(Model, "ContentGrid")
    

    But I just get this error, and I cannot find a solution:

    cannot convert from 'Umbraco.Web.PublishedModels.IContentComposition' to 'Umbraco.Core.Models.PublishedContent.IPublishedProperty'

    What am I missing?

    The composition has alias contentComposition and the editor has contentGrid

  • Allan Kirk 9 posts 99 karma points c-trib
    Mar 04, 2019 @ 07:33
    Allan Kirk
    0

    I found the solution included in this post

    https://our.umbraco.com/packages/backoffice-extensions/nested-content/nested-content-feedback/88837-how-to-render-grid-layout-in-nested-content

    Because the grid is in a composition, you have to use GetProperty: @Html.GetGridHtml(Model.GetProperty("contentGrid"))

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Mar 04, 2019 @ 08:44
    Søren Gregersen
    0

    Are you not able to use the Property that modelsbuilder provides?

  • Allan Kirk 9 posts 99 karma points c-trib
    Mar 05, 2019 @ 04:54
    Allan Kirk
    0

    I don't know how to answer that question. What do you expect should work? I tried a bunch of things, and this is the only thing that has worked so far.

Please Sign in or register to post replies

Write your reply to:

Draft