Order Dynamic Module Items by NEWID

Posted by laura@refactoredmedia.com on 05-Feb-2020 01:16

I created a dynamic module in Sitefinity MVC v 12.2. When I list the items on the page, I want them to be in a random order. I added the module widget on the page and went to Edit > Advanced > Model and in SortExpression I entered NEWID(). but got the error "No applicable method 'NEWID' exists in type 'HeroSlide'"  - How do I get them to show up randomly?

All Replies

Posted by jread on 05-Feb-2020 16:51

Try adding this to the sort expression:

DateCreated.ToString().Substring((DateTime.Now.Second % 10), 4) DESC

With that it will randomize each load based on current time

This thread is closed