Rotator - Random Order

Demo Configurator

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB

Telerik RadRotator can be configured to shows random items by setting its EnableRandomOrder="true" property. If this property is set to true then, the third item can be shown first, for example. This does not change the item's index, however, and if the first item is clicked (and it is actually the third one in the rotator's item collection) its index will be 2 (the indexes start from 0)

In this example, RadRotator shows the content of a directory. The images are loaded using the GetFilesInFolder method, shown in the codebehind file.

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • styles.css
<%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Rotator.RandomOrder.DefaultCS"CodeFile="DefaultCS.aspx.cs"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" type="text/css" />
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager runat="server">
            <telerik:AjaxSetting AjaxControlID="chbEnableRandomOrder">
                    <telerik:AjaxUpdatedControl ControlID="RadRotator1" />
                    <telerik:AjaxUpdatedControl ControlID="chbEnableRandomOrder" />
    <div class="demo-container size-medium">
        <div class="rotatorBackground">
            <telerik:RadRotator RenderMode="Lightweight" ID="RadRotator1" runat="server" Width="348px" Height="91px" CssClass="horizontalRotator"
                                ScrollDuration="500" FrameDuration="2000" ItemHeight="91" ItemWidth="58" EnableRandomOrder="true"
                                PauseOnMouseOver="false" Skin="Windows7">
                    <div class="itemTemplate">
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Container.DataItem  %>' AlternateText="<%# VirtualPathUtility.GetFileName(Container.DataItem.ToString()) %>">
    <qsf:ConfiguratorPanel runat="server">
            <qsf:View runat="server">
                    <asp:CheckBox ID="chbEnableRandomOrder" runat="server" Text="EnableRandomOrder" Checked="true"
                                  AutoPostBack="true" OnCheckedChanged="chbEnableRandomOrder_CheckedChanged"></asp:CheckBox>

Find Assistance

Help Us Improve

Was this example helpful?