Copied to clipboard

Flag this post as spam?

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


  • David Amri 214 posts 740 karma points
    Feb 17, 2017 @ 07:56
    David Amri
    0

    Match current page dropdown list multiple values with its siblings

    Good morning,

    I'm trying to figure out a way to show a list of nodes with the same selected dropdown list prevalues as the current page.

    Say my current page selected dropdown list prevaules are:

    "blue", "white" and "red".

    Now I would like to list all sibling nodes with the same selected prevaules.

    Happy funky Friday!

  • Marc Goodson 2157 posts 14434 karma points MVP 9x c-trib
    Feb 18, 2017 @ 08:59
    Marc Goodson
    100

    Hi David

    Something like this ?

    @{ 
        //get current colour dropdown value
        var currentColour = Model.Content.GetPropertyValue<string>("colour");
        // we get the parent of the current page, and look for all children with the matching colour property
        var similarColouredSiblings = Model.Content.Parent.Children(f => f.Id != Model.Content.Id && f.HasValue("Colour") && f.GetPropertyValue<string>("Colour") == currentColour);
    }
    <ul>
        @foreach (var sibling in similarColouredSiblings)
        {
            <li>@sibling.Name - @sibling.Id - @sibling.GetPropertyValue("Colour")</li>
        }
    </ul>
    

    (there aren't zillions of siblings ?)

    regards

    Marc

  • David Amri 214 posts 740 karma points
    Feb 20, 2017 @ 08:21
    David Amri
    0

    Thank's Marc,

    I will try this out today.

    Not zillions, but hundreds... :) Something like 200 to be more specific.

  • 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