Copied to clipboard

Flag this post as spam?

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


  • Jason Spence 7 posts 118 karma points
    Sep 05, 2017 @ 23:32
    Jason Spence
    0

    Upgrade to 7.6.1 error loading macro partials using Content.Url

    Hello,

    I'm in the process of upgrading our website to Umbraco v7.6.1 via NuGet package. The upgrade worked, but I get runtime errors on pages that use macro partials where I'm using code to access the Umbraco content API to return data. Any help is greatly appreciated.

    Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Array' does not contain a definition for 'Url'
    

    @foreach (var item in selection) { <div class="col-sm-4 loan-option"> <section class="item-img-wrap"> <a href="@Umbraco.Content(item.linkUrl).Url" class="item-img" style="background-image: url(https://assets.newamericanfunding.com@(Umbraco.Media(item.backgroundImage).Url))"></a> </section> <section class="option-wrap @item.name.Replace(" ", "-").ToLower()"> <div> <h3 class="item-title"><a href="@Umbraco.Content(item.linkUrl).Url">@Html.Raw(item.itemTitle)</a></h3> <h4 class="item-desc">@item.itemDescription</h4> </div> </section> </div> }

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Sep 06, 2017 @ 08:47
    Alex Skrypnyk
    100

    Hi Jason

    Problem can be with Property Value Converters, please have a look:

    https://our.umbraco.org/documentation/getting-started/setup/upgrading/760-breaking-changes#property-value-converters-u4-7318

    Please, disable Property Value Converters or just rewrite your code, I think it should be :

    <a href="@item.linkUrl.Url" class="item-img" style="background-image: url(https://assets.newamericanfunding.com@(item.backgroundImage.Url))"></a>
    

    Thanks,

    Alex

  • Jason Spence 7 posts 118 karma points
    Sep 06, 2017 @ 15:53
    Jason Spence
    0

    Thank you, Alex!

    I adjusted the code to use @item.linkUrl.Url wherever I'm getting Umbraco content. Do you recommend code rewrite or disabling Property Value Converters?

    Jason

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Sep 06, 2017 @ 15:53
    Alex Skrypnyk
    0

    I recommend code rewrite, Property Value Converters is an awesome feature of Umbraco.

    Thanks,

    Alex

  • Jason Spence 7 posts 118 karma points
    Sep 06, 2017 @ 15:55
    Jason Spence
    1

    Okay cool. Thank you for your time!

    Jason

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Sep 06, 2017 @ 16:16
    Alex Skrypnyk
    0

    You are welcome, Jason.

    Alex

Please Sign in or register to post replies

Write your reply to:

Draft