Take combined with OrderBy isn't returning expected results
Hi, I have this loop thats supposed to print the latest 3 blog posts and sort them by the postDate (datepicker) property. Whats happening is that if there are more than 3, it doesn't actually show the most recent one, if I change the Take(3) to Take(4) it shows the latest 4 items in the correct order. Any idea why this is happening?
foreach (var node in nodes.Take(3).OrderBy("postDate desc"))
Take combined with OrderBy isn't returning expected results
Hi, I have this loop thats supposed to print the latest 3 blog posts and sort them by the postDate (datepicker) property. Whats happening is that if there are more than 3, it doesn't actually show the most recent one, if I change the Take(3) to Take(4) it shows the latest 4 items in the correct order. Any idea why this is happening?
-Amir
Hi,
Try to change the order.. ie. "nodes.OrderBy("postDate desc").Take(3)" .. ;)
/ulrich
Ulrich, you are the man! Thank you!
-Amir
is working on a reply...