Syntax* 

Welcome to Pull Digital's technology blog Syntax*.

Order Kentico Repeater Results Ramdomly

When I first asked Kentico support how to do this they came back with the rather simple answer of just adding NewID() to the OrderBy field in the repeater:



This seemed to do the trick and the first time I re-loaded the page the signpost I was working on swapped to another version.

The problem when using this approach is that once the site went live and we optimised the caching options it no longer worked. Its not something we immediately noticed but it became apparent that none of the NewID() ordered repeaters worked.

A quick chat with Kentico later it was identified that the site caching options were affecting the rendering of the random items, to fix this we needed to set the cache options in the repeater:



Setting the Cache minutes to 0 overrides the site settings and fixes the issue.

Some Of Our Clients

  • First-Central
  • Boux-Avenue
  • Conversis
  • John-Lewis
  • EY
  • Kompan
  • Living-Streets
  • Meteor
  • OSI
  • Schwarzkopf
  • GoCycle
  • SSTL
  • Chaucer-Direct
  • TurtleMat
  • UK200Group
  • ASDA
  • Vinci
  • Zoggs

We Deliver Marketing CertaintyTM

Find Out More