Copied to clipboard

Flag this post as spam?

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


  • Jon 47 posts 290 karma points
    Sep 14, 2018 @ 12:28
    Jon
    0

    Umbraco.MultipleTextstring » Comma separated

    Hi Umbracos

    Im trying to get this MultipleTextstring to show as an Comma Separated list. Code working – just missing the commas?

       @{
            if (Model.Content.GetPropertyValue<string[]>("tags").Length > 0)
            {
              foreach (var tag in Model.Content.GetPropertyValue<string[]>("tags"))
                    {
                        @tag
                    }
            }
        }
    
  • Kevin Jump 2341 posts 14868 karma points MVP 8x c-trib
    Sep 14, 2018 @ 13:09
    Kevin Jump
    100

    Hi

    once you have the tags in an array you can use string.Join to put the comma in

    var tags = Model.Content.GetPropertyValue<string[]>("tags")
    @string.Join(", ", tags);
    

    will add , (and space) between each item in the list

Please Sign in or register to post replies

Write your reply to:

Draft