Copied to clipboard

Flag this post as spam?

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


  • Matthew 93 posts 153 karma points
    Dec 26, 2012 @ 10:22
    Matthew
    0

    How would I retrieve 1st, 2nd, 3rd nodes separately, and then the rest?

    I want to display the 1st, 2nd and 3rd nodes differently than the rest.  The goal is to highlight the next 3 upcoming events in a special layout, then all the rest in a list.  I think I need to build an array, ordered by date, and assign a number to each, then pick out 1,2,3 individually, then loop out 4 and above in the list.  I can't find an example to build on.

    Any ideas?  All gifts merrily welcomed.

  • Ben Norman 167 posts 276 karma points
    Dec 26, 2012 @ 12:00
    Ben Norman
    101

    var items = Model.Children.OrderBy("dateField");

    var first = items.First();

    var second = items.Take(2).Last();

    var third = items.Take(3).Last();

    var list = items.Skip(3);

    See how that goes :)

  • Matthew 93 posts 153 karma points
    Dec 26, 2012 @ 19:23
    Matthew
    0

    Wow, that easy, too cool.  Thanks very much!

Please Sign in or register to post replies

Write your reply to:

Draft