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
    1 week ago
    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 1191 posts 7192 karma points MVP 2x c-trib
    1 week ago
    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