Copied to clipboard

Flag this post as spam?

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


  • stephen 67 posts 108 karma points
    Sep 03, 2018 @ 18:24
    stephen
    0

    All the documentation seems to suggest displaying the grid content via a Template but is there a way to display the content within a Partial View?

    I have tried something like this:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Test>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @Html.GetGridHtml(Model.Content, "propertyAlias")
    

    but I get Object Reference not set...etc

    I can use

    @Umbraco.Field("fieldname")
    

    which returns json, but that's not really helpful.

    It works fine in the Master template, but that's not much use either.

  • Paul Seal 395 posts 2156 karma points MVP 2x c-trib
    Sep 04, 2018 @ 12:54
    Paul Seal
    101

    Hi From a partial view, you can access the Grid like this:

    @Html.GetGridHtml(Umbraco.AssignedContentItem, "propertyAlias")
    

    Kind regards

    Paul

  • stephen 67 posts 108 karma points
    Sep 04, 2018 @ 14:32
    stephen
    0

    Worked. Many thanks!

  • Paul Seal 395 posts 2156 karma points MVP 2x c-trib
    Sep 07, 2018 @ 12:44
    Paul Seal
    0

    You're welcome, please mark the solution so people know it is solved.

    Kind regards

    Paul

Please Sign in or register to post replies

Write your reply to:

Draft