Copied to clipboard

Flag this post as spam?

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


  • Keith R Hubbard 175 posts 403 karma points
    Aug 25, 2016 @ 17:44
    Keith R Hubbard
    0

    nested Content stops working after 7.52 Upgrade

    I had the following working until i upgraded to 7.52. this is a composition named product that has a link for external site. after the upgrade it is like Umbraco can not see Nested Content.

    @{
        var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("product");
    
        <div class="row">
            @foreach (var item in items)
            {
                var widgetLink = item.GetPropertyValue<UrlPicker>("productLink");
                var imageId = item.GetPropertyValue<int>("productImage");
                var image = Umbraco.TypedMedia(item.GetPropertyValue("productImage"));
    
                if (widgetLink != null && widgetLink.Meta != null && widgetLink.Type != null)
                {
                    var linkTarget = widgetLink.Meta.NewWindow ? "_blank" : null;
                    var linkUrl = widgetLink.Url;
    
                    string linkText = null;
                    if (widgetLink.Meta.Title != null)
                    {
                        linkText = widgetLink.Meta.Title;
                    }
    
                    if (widgetLink.Type == UrlPicker.UrlPickerTypes.Url)
                    {
                        if (!string.IsNullOrEmpty(linkUrl) && !(linkUrl.StartsWith("http://") && !(linkUrl.StartsWith("https://"))))
                        {
                            linkUrl = "http://" + linkUrl;
                        }
                    }
    
                    if (!string.IsNullOrEmpty(linkUrl))
                    {
                        <div class="col-lg-3">
    
                            <a href="@linkUrl" target="@linkTarget" title="@linkText">
                                @if (item.HasValue("productImage"))
                                {
                                    <img class="img-responsive" src="@image.Url" width="270" height="100" alt="@item.Name"/>
                                }
                            </a>
                        </div>
                    }
                }
            }
        </div>
    }
    
  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 25, 2016 @ 18:21
    Lee Kelleher
    0

    Hi Keith,

    After you call...

    var items = Model.GetPropertyValue<IEnumerable<IPublishedContent>>("product");
    

    Does @items contain any value?

    I haven't heard of any problems with NestedContent on v7.5.x yet.

    Cheers,
    - Lee

  • Keith R Hubbard 175 posts 403 karma points
    Aug 25, 2016 @ 18:31
    Keith R Hubbard
    0

    hello Lee

    the items is just a collection of the items in the composition. see attached image

    enter image description here

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 25, 2016 @ 18:34
    Lee Kelleher
    0

    OK, does it contain any values when you run the Razor code?

  • Keith R Hubbard 175 posts 403 karma points
    Aug 25, 2016 @ 18:34
    Keith R Hubbard
    0

  • Keith R Hubbard 175 posts 403 karma points
    Aug 25, 2016 @ 18:37
    Keith R Hubbard
    0

    it kills all my razor code. it only sees the sections and div's

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Aug 26, 2016 @ 08:16
    Lee Kelleher
    1

    Hi Keith,

    It's pretty impossible for me to know what the cause it without any error messages, etc.

    Have you tried a process of elimination? Removing code (commenting out) and seeing what does work until you hit the line of code that is causing the problem?

    Thanks,
    - Lee

  • Keith R Hubbard 175 posts 403 karma points
    Aug 26, 2016 @ 19:22
    Keith R Hubbard
    0

    Lee Luckily I had Jeavon look at it. For some reason Urlpicker will not update to v.0.16 with NuGet or package install. Any ideas would help.

Please Sign in or register to post replies

Write your reply to:

Draft