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 414 posts 1655 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 414 posts 1655 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

  • Charlene 1 post 71 karma points
    Sep 30, 2020 @ 14:08
    Charlene
    0

    Thank you for this! It helped a ton

  • David Armitage 414 posts 1655 karma points
    Oct 01, 2020 @ 00:23
    David Armitage
    0

    Glad I could help.

    Regards David

  • 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