Copied to clipboard

Flag this post as spam?

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


  • Johannes Lantz 55 posts 260 karma points
    Apr 05, 2019 @ 06:24
    Johannes Lantz
    0

    Gettins tags without foreach

    Hello all,

    I have been trying now to print all tags without using a foreach loop. But I am not getting the result that I want.

    If I just use Model.Content.GetPropertyValue I get "System.String[]" I have been trying to type it but still getting the same result.

    If I set "EnablePropertyValueConverters" to false, then it works. But I would like to make it work without setting EnablePropertyValueConverters to false.

    Any idés?

    (Using umbraco v 7.14)

  • Jonathan Distenfeld 105 posts 618 karma points
    Apr 07, 2019 @ 16:11
    Jonathan Distenfeld
    100

    Hello Johannes,

    you can use String.Join to display your tags:

    @String.Join(",", propertyvalue)
    

    You might have to make sure to get the right propertytype first:

    Model.Content.GetPropertyValue<String[]>("youproperty")
    

    -Jonathan

  • Johannes Lantz 55 posts 260 karma points
    Apr 07, 2019 @ 17:54
    Johannes Lantz
    1

    Cheers Jonathan!

    @String.Join(",", Model.Content.GetPropertyValue<String[]>("property"))
    

    Works like a charm!

  • 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