RadRotator HowTo Questions

5 posts, 1 answers
  1. Cole
    Cole avatar
    20 posts
    Member since:
    Jun 2008

    Posted 28 Nov 2008 Link to this post

    Hey there,

    Working with radrotator similar to the image gallery example shown on your website.  2 things I am wondering...

    1. how can i detect the current items shown out of the array?  Preferably on the client side, but if not, server-side is fine too.  That is, if I have 27 items and the room to show 4 at a time... how could i tell as I rotate through them which is the start/end items in my list?
    e.g. I want to have "Now showing 5 to 9 of 27" text below my rotator.  I want the '5'/'9' numbers to be updated either on Page_Load (initially) or after I move the screen left/right one.   Anyone know how to do this?

    2. Supposing the '5' in the example above was actually a text box the user could type in and hit <ENTER> to set the starting item... how could I do this? 
    Edit: 1 more question related to the radrotator...

    1. In OnItemclick server-side event, the rotator seems to reset to the first item in the list.  How can I set it to stay at the current frame.  E.g. if I show 4 items at once and have moved over 7, how can I set it up that if I click on the 3rd item, it is in 3rd position of the visible elements in the rotator on page postback.


    Thx,
    Rob
  2. Cole
    Cole avatar
    20 posts
    Member since:
    Jun 2008

    Posted 01 Dec 2008 Link to this post

    Anyone have thoughts on these questions? 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Lini
    Admin
    Lini avatar
    2144 posts

    Posted 02 Dec 2008 Link to this post

    Hello Rob,

    1. You can use the rotator client API to count the items as they are scrolled into view. For example if the scroll direction is left, you increase the current item number by one, if the scroll direction is right - decrease by one. You can do this by using the OnClientItemShown event.

    2. You can do this with the InitialItemIndex server rotator property. Set the property to the index of the first item you wish to show (e.g. 5) and the rotator will position this item at the beginning of the viewport.

    3. Again you can do that with the InitialItemIndex property. The server OnItemClick event has a reference to the clicked item and its index, which you can use to set the InitialItemIndex.

    All the best,
    Lini
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Cole
    Cole avatar
    20 posts
    Member since:
    Jun 2008

    Posted 03 Dec 2008 Link to this post



    This is my javascript method that gets called for onClientItemShown method in my rotator... it tracks the first item achieving the functionality I wanted... just sharing it.

    One question though... trial and error allowed me to see the allowable values for the get_animationDirection()... are these stored as constants at all?  I hate the "== 2" I am using.

    Thx,
    Rob



       function previewItemShown(sender, args)
            {
                var change = (sender.get_animationDirection() == 2)?-1:1;
                var hiddenElement = document.getElementById("<%= PreviewStripIdx.ClientID %>");
                 var currentIdx = parseInt(hiddenElement.value);
                            
                var totalItems = parseInt(document.getElementById("<%=TotalNumberOfPhotosInStrip.ClientID %>").value);

               
                var newIdx = currentIdx + change;
                
                if (newIdx < 0)
                    newIdx = totalItems - 1;
                else if (newIdx >= totalItems)
                    newIdx = 0;

                hiddenElement.value = newIdx;            
            }
  6. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 04 Dec 2008 Link to this post

    Hi Rob,

    Yes, the directions are stored in the Telerik.Web.UI.RotatorScrollDirection enum on the client. You can use Telerik.Web.UI.RotatorScrollDirection.Left, .Right, .Up, or .Down.

    Regards,
    Lini
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017