This is a migrated thread and some comments may be shown as answers.

Radrotator Items/Frames Count

1 Answer 64 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Rahul asked on 16 Jan 2014, 02:14 PM
       The below mention is the radrotator controls which I have created.  

<script type=
    function OnClientButtonClick(sender, args) {
//        debugger;
        var currentIndex = sender.get_currentItem().get_index();
        var count = sender.get_items().length;
        var frames = Math.ceil(count / 3);
        var tot = 1;
            if (currentIndex % 3 == 0) {
                tot = 2 + (sender.get_currentItem().get_index() / 3);
            else if (currentIndex == 0)
                tot = 1;
        var com = tot + '/' + frames;
        document.getElementById('<%= this.Label1.ClientID %>').innerHTML = com;
<telerik:RadRotator ID="ImageStrip_RadRotator" InitialItemIndex="0" runat="server" RotatorType="CoverFlowButtons" >
                        <telerik:RadBinaryImage ID="RadBinaryImage1" CssClass="itemTemplate" runat="server" DataValue='<%# Eval("Photo") == DBNull.Value? new System.Byte[0]: Eval("Photo") %>'
                            AutoAdjustImageControlSize="false" />
                    <ControlButtons OnClientButtonClick="OnClientButtonClick" />

   I have given the rotator dimensions and rotator type in .cs file,which is working fine. The rotator shows 3 images per frame.Suppose if there are 7 images then 3 frames will be shown. I'm getting the number of frames from "Var Frames" in the script.
  What I want is that how to find the current frame if i move the left/right button in rotator  ? I have attached a screenshot also.
If you are not able to find out the current frame, can you tell me this with respect to number of images in the rotator and the current image in focus. I'm looking for a javascript.


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 21 Jan 2014, 09:12 AM
Hello Rahul,

You can use the following line, in which sender is the client-side object of the RadRotator, as you did in your script, however I would suggest doing so in the event OnClientItemShown instead of OnClientButtonClick, because it is fired when the current item index is updated:

Once you have the index, you can determine which is the currently displayed item.

I hope this helps. Feel free to contact us again if you are still having difficulties or if I am missing something.

If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question