Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want a list of items (nodes) to display on a page in a random order. Is there any way to do that?
But that only returns 1 item.
I've also tried something like this:
node.ChildrenAsList.Where("show").OrderBy(x => Guid.NewGuid());
But that results in an error too, because I can't use a lambda expression there.
Any other ideas?
I can't be the first that needs to shuffle a list of nodes, can I?
It your node is CurrentPage you can use Model.Content instead:
var random = Model.Content.Children.Where("show").OrderBy(x => Guid.NewGuid());
easiest way is to use .Random(#)
Replace # with the number of results or to display all - if there aren't too many - put in a number which will cover the lot.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted