Copied to clipboard

Flag this post as spam?

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


  • David Armitage 243 posts 923 karma points
    Jan 25, 2020 @ 01:22
    David Armitage
    0

    Umbraco 8 | How to display a Grid within Nested Content

    Hi Peeps,

    I have been having trouble displaying a Grid View inside nested content with Umbraco 8.

    I have done this 100ds of times with Umbraco 7 and never had any problems.

    In the backend there is no problem. I can add a Grid View to the nested content section an it seems to populate as expected.

    The trouble is when it comes to render i the frontend.

    So the usual code @Html.GetGridHtml("WHAT GOES HERE", "mainText", "bootstrap3-fluid")

    With Umbraco 7 I used to just pass the nested content section model which is IPublishedContent and it just works.

    The problem with Umbraco 8 is that the Grid is wanting an IPublishedContent and the nested content section model with Umbraco 8 is now IPublishedElement.

    Is their to get the Grid to either accept IPublishedElement or is there anyway to cast IPublishedElement into IPublishedContent?

    Thanks in advanced

    David

  • David Armitage 243 posts 923 karma points
    Jan 25, 2020 @ 01:46
    David Armitage
    100

    Hi Guys,

    So I figured this out. You can actually pass in IPublishedProperty instead of content.

    I couldn't see this for looking.

    Anyway if anyone has the same problem then the way I achieved this was.

    @Html.GetGridHtml(nestedContent.GetProperty("mainText"),"bootstrap3-fluid")

    Regards David

Please Sign in or register to post replies

Write your reply to:

Draft