Copied to clipboard

Flag this post as spam?

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


  • Nso 18 posts 87 karma points
    Jul 24, 2018 @ 07:51
    Nso
    0
        @{
        var selection2 = Model.Content.Site().FirstChild("specialitasaink").FirstChild("termekKontener").Children("termekElem")
                            .Where("fooldaliMegjelenites");
    }
    
    @{
        var selection3 = Model.Content.Site().FirstChild("specialitasaink").FirstChild("termekKontener").Children("termekElem")
                            .Where("fooldaliMegjelenites");
    }
    

    Hey, I would like to ask for help. I want to query with selection2 the first item, an with selection3 the other items except the first. How can I do this?

  • Marc Goodson 2146 posts 14350 karma points MVP 8x c-trib
    Jul 25, 2018 @ 00:32
    Marc Goodson
    1

    Hi Nso

    If I understand correctly would this work for you?

    @{
    var allSelections = Model.Content.Site().FirstChild("specialitasaink").FirstChild("termekKontener").Children("termekElem")
                            .Where("fooldaliMegjelenites");
    
    var firstSelection = allSelections.FirstOrDefault();
    var remainingSelections = allSelections.Skip(1);
    
    }
    

    You might find better performance in writing the first selection of items with XPath, eg

    var allSelections = Umbraco.TypedContentAtXPath("root/homePage/specialitasaink/termekKontener/termekElem/fooldaliMegjelenites[@isDoc]"); (or similar depending on the xml in your published umbraco.config file)

Please Sign in or register to post replies

Write your reply to:

Draft