Copied to clipboard

Flag this post as spam?

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


  • Amir Khan 1282 posts 2739 karma points
    Oct 08, 2021 @ 18:26
    Amir Khan
    0

    MNTP2 Loop through nodes and only show selected values

    I have a blog category picker which is a multi node tree picker, the categories are defined by other documents on the site, like various industries in the industries section. The problem is, the blog is new so there are lots of empty categories. Is it possible to loop through all of the posts somehow and only show the MNTP options that have been selected on any of the posts?

    Currently I'm looping through like this, but this loop doesn't know if any of the options have been "chosen" on a blog post.

     var resourceTypeStart = Umbraco.Content(3855);
        var resourceTypeSelection = resourceTypeStart.Descendants().Where("Visible");
    
    
             <ul>
                    @{
                        foreach (var resourceTypeFilter in resourceTypeSelection) {
                                <li><a href="/resources/[email protected]">@resourceTypeFilter.Name</a></li>
                        }
    
                    }
                </ul>
    
Please Sign in or register to post replies

Write your reply to:

Draft