Copied to clipboard

Flag this post as spam?

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

  • Allie 26 posts 116 karma points
    Jul 30, 2021 @ 17:16

    Hey everybody, I'm new in umbraco, so can sb help me ?..

    enter image description here

                                   @foreach(var subitem in item.Children)
                                        List<string> categories = subitem.Pluck("category");
                                         foreach(var category in @categories.Distinct()) {
                                              <a href="@subitem.Value("contentLink")" title="@subitem.Value("title")">@subitem.Name</a>

    Kind regards :)

  • Søren Gregersen 441 posts 1884 karma points MVP 2x c-trib
    Jul 30, 2021 @ 18:09
    Søren Gregersen


    What should Pluck do? Is that something from Rails / ActiveRecord?

    If you have defined "category" as a TextBox, you could get the "category" as a string, with subitem.Value<string>("category"). If it is a MultiNodeTreePicker, you can get the value as a list of picked nodes - subitem.Value<IEnumerable<IPublishedContent>>("category")

    There is a description of all the built in types here

    HTH :)

Please Sign in or register to post replies

Write your reply to: