Copied to clipboard

Flag this post as spam?

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


  • Michael Beever 74 posts 155 karma points
    May 14, 2020 @ 11:51
    Michael Beever
    0

    Partial View / Nested / Multi URL Picker

    Hello

    I am trying to create a Partial View that contains nested items which within it has a Multi URL picker.

    This is what i have so far:

    @{
    
    var LinkImages = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("linksImagesNested");
    
                foreach(var item in LinkImages)
                {
    
                    var LinkURL = item.GetPropertyValue<Umbraco.Web.Models.Link>("LinkURL");
                    var LinkTitle = item.GetPropertyValue("LinkTitle");
                    var LinkText = item.GetPropertyValue("LinkText");
                    var LinkImg = item.GetPropertyValue<IPublishedContent>("LinkImg");
    
    
    
                     <div class="col-md-4 border">
                        <a href="@LinkURL">
            gh @LinkURL.Url
                        </a>
                    </div>                   
    
                }
    
    }
    

    The problem is that LinkURL.Url does not produce anything. I have tried several different ways and no further forward.

    Any ideas?

    Thanks

  • Yakov Lebski 591 posts 2347 karma points
    May 14, 2020 @ 12:43
    Yakov Lebski
    0

    check type of object in

    var LinkURL = item.GetPropertyValue<Umbraco.Web.Models.Link>("LinkURL");
    

    maybe it has multiple items?

       var LinkURL = item.GetPropertyValue<IEnumerable<Umbraco.Web.Models.Link>>("LinkURL");
    
  • Michael Beever 74 posts 155 karma points
    May 14, 2020 @ 12:46
    Michael Beever
    0

    Step forward but still cannot get the URL out.

    I have tried this

                     <div class="col-md-4">
                        <center><div class="border"><a href="@LinkURL.Url"><img src="@LinkImg.Url">
                        <p>@LinkText</p>
                        </a></div></center>
                    </div>   
    

    But get this error

    CS1503: Argument 1: cannot convert from 'method group' to 'object'

  • Dmitriy 168 posts 588 karma points
    May 14, 2020 @ 13:01
    Dmitriy
    0

    As Yakov said, you should check the type of result first like that

      var LinkURL = item.GetPropertyValue<IEnumerable<Umbraco.Web.Models.Link>>("LinkURL");
    

    MultiUrlPicker returns IEnumebarable<Umbraco.Web.Models.Link> type

  • Michael Beever 74 posts 155 karma points
    May 14, 2020 @ 13:04
    Michael Beever
    0

    This is the Page in question.

    https://xpsbridge.sail-dev.com/lgps-employers/newsletters/

    I have @LinkURL showing on the page.

  • Michael Beever 74 posts 155 karma points
    May 14, 2020 @ 13:10
    Michael Beever
    0

    Sorted thanks

    I had not set the Max Value

Please Sign in or register to post replies

Write your reply to:

Draft