Copied to clipboard

Flag this post as spam?

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

  • Jan Brinker 77 posts 103 karma points
    May 13, 2013 @ 11:01
    Jan Brinker

    Wrong return type of Umbraco.Field when recursive:true

    Arr mateys,

    yesterday I was building my new web (Umbraco 6.0.5) and found a bug when writing my template. I want the logo of my site to be changable on the Home node, so I created a media picker property on my Frontpage document type with the Alias "logoImage". Somewhere in my template I had this:

    <img src="@Umbraco.Media(Umbraco.Field("logoImage", recursive: true)).Url" alt="Logo"/>

    This resulted in a YSOD (Exception Details: System.InvalidOperationException: The value of parameter 'id' must be either a string or an integer). When omitting the recursive:true, though, or switching to CurrentPage.logoImage, it works (well, as long as I don't open up a sub-page).

    For the moment I found a workaround though, by adding a .ToString() to the Umbraco.Field, making it:

    <img src="@Umbraco.Media(Umbraco.Field("logoImage", recursive: true).ToString()).Url" alt="Logo"/>

    But of course this is not how it's supposed to be like :)



  • Gaytri Nagpal 1 post 21 karma points
    Jun 10, 2014 @ 07:56
    Gaytri Nagpal

    Please help, my recursive true in Umbraco 7.0 is not working. My case is :-

    <div class="innerBannerWrap" style="background-image:url(@Umbraco.Media(@Umbraco.Field("industriesBgImage", recursive: true).ToString()).Url)">



Please Sign in or register to post replies

Write your reply to: