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.
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.
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 :)
Wow, that easy, too cool. Thanks very much!
is working on a reply...