Copied to clipboard

Flag this post as spam?

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


  • John Hudiel 32 posts 102 karma points
    Apr 09, 2018 @ 16:57
    John Hudiel
    0

    Multi URL picker help

    Hi Guys,

    Just started using umbraco and i can't seem to get this package to work. I'm not using the model viewer for my site.

    How can you access the values you've stored?

    Here is a sample code i created

        @inherits Umbraco.Web.Mvc.UmbracoTemplatePage{
    @{
        var Category = Model.Content.GetPropertyValue<MultiUrls>("categoryLinks");
    }
    @if (Category.Count > 0)
                                {
                                  <ul>
                                    @foreach (var item in Category)
                                    {
                                      <li><a href="@item.Url" target="@item.Target">@item.Name</a></li>
                                    }
                                    </ul>
                                }
    }
    

    I am getting a parsing error for this

    Can anyone point me in the right direction?

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 09, 2018 @ 18:59
    Alex Skrypnyk
    0

    Hi John

    Are you using this package - https://our.umbraco.org/projects/backoffice-extensions/multi-url-picker/ ?

    All files are in place?

    What error did you get?

    /Alex

  • John Hudiel 32 posts 102 karma points
    Apr 10, 2018 @ 08:20
    John Hudiel
    0

    Yes thats the package I'm using. I am getting a parsing error when I'm adding the get property value for multi urls.

    All files are in place in the App_Plugins.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 10, 2018 @ 09:03
    Alex Skrypnyk
    0

    Add please:

    @using RJP.MultiUrlPicker.Models

    And what parsing error did you get?

    Can you check what is storing in "categoryLinks" Umbraco field?

  • John Hudiel 32 posts 102 karma points
    Apr 10, 2018 @ 09:35
    John Hudiel
    0

    Hi Alex,

    Thanks for the reply, have found another way to get what I want. This will do for now as I am really pressed for time.

    Really appreciate the reply.

  • Alex Skrypnyk 5908 posts 22603 karma points MVP 4x admin c-trib
    Apr 10, 2018 @ 10:04
    Alex Skrypnyk
    0

    You are welcome, John.

    Aks if you have a question, have a nice day!

  • Bjarne Fyrstenborg 1182 posts 3441 karma points MVP 4x c-trib
    Apr 10, 2018 @ 11:41
    Bjarne Fyrstenborg
    2

    Hi John

    If you are using the latest version of the Multi Url Picker package, so shouldn't use MultiUrls since it is deprecated.

    Instead cast the value IEnumerable<Link> or Link if you have set maximum = 1 in the property editor config.

    var categories = Model.Content.GetPropertyValue<IEnumerable<Link>>("categoryLinks");
    
    var category = Model.Content.GetPropertyValue<Link>("categoryLink");
    

    if you are using ModelsBuilder you can just write:

    var categories = Model.Content.CategoryLinks;
    

    or

    var categories = myNode.CategoryLinks;
    

    /Bjarne

  • 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