Kentico Tip : Random Document

by Joel Dahlin on February 5, 2015

Kentico Tip : Random Document

Lets say you have a carousel of slides, a ticker or even a static image that you would like to be randomized on page load so the user doesn't see the same one every time.

If you're using a Repeater, a Content Slider, or similar webpart you can set the ORDER BY expression equal to NEWID(). If you only want one item to show up, but to be randomized set the  Select top N documents equal to 1.

#tip #webpart

Blog post currently doesn't have any comments.
 Security code