Copied to clipboard

Flag this post as spam?

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


  • Nathan Rogan 22 posts 203 karma points
    Jan 28, 2021 @ 14:16
    Nathan Rogan
    0

    Render grid in MNTP

    Hi, does anyone know if it's possible to render a grid property in a Multinode Tree Picker? I'm trying to do it within a partial view.

    Umbraco 8.9.2

    I get this error:'System.Web.HtmlString' does not contain a definition for 'sections'

    Partial view:

    @inherits Umbraco.Web.Mvc.UmbracoViewPage
    @using ContentModels = Umbraco.Web.PublishedModels;
    @using Umbraco.Web.Models;
    
    
    <div class="links-info-blocks">
        <div class="wmcads-col-1">
            <h2>@Model.Value("pageLinksTitle")</h2>
        </div>
        <div class="link-info-blocks">
            @{
                var mntpLinks = Model.Value<IEnumerable<IPublishedContent>>("mntpLinks");
            }
            @foreach (var item in mntpLinks)
            {
                <div class="col-1">
                    <div class="link-info-block">
                        <h3>@item.Name</h3>
                        @if (item.Value("copy") != null)
                        {
                            @Html.GetGridHtml(item.GetProperty("copy"));
                        }
                        <div class="text-right">
                            <a class="btn-secondary" href="@item.Url">Read more</a>
                        </div>
                    </div>
                </div>
            }
        </div>
    </div>
    
  • Amir Khan 1289 posts 2746 karma points
    Jan 28, 2021 @ 17:57
    Amir Khan
    0

    I think you have an extra closing bracket in there.

  • Nathan Rogan 22 posts 203 karma points
    Jan 28, 2021 @ 18:30
    Nathan Rogan
    0

    Thanks but that's not the issue. I have a lot more code than above, I just removed some so it's easier to read on the forum.

  • Bo Jacobsen 610 posts 2409 karma points
    Jan 28, 2021 @ 21:06
    Bo Jacobsen
    100

    Hi Nathan.

    Maybe this works

    @Html.GetGridHtml(item, "copy", "gridTemplateName")
    
  • Nathan Rogan 22 posts 203 karma points
    Jan 29, 2021 @ 11:01
    Nathan Rogan
    0

    I thought I'd tried that but obviously not. That's worked perfectly. Thanks for your help

  • 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