RadRotator - button navigation

4 posts, 0 answers
  1. Praveen Pawar
    Praveen Pawar avatar
    4 posts
    Member since:
    Jan 2010

    Posted 28 Feb 2010 Link to this post

    Hello all,
    I have a general question about button style navigation in RadRotator. 
    I've implemented paging in my solution and my default setting is to display 10 items per page. Whether it is in horizontal or vertical display mode, once I get to item 10 (index of 9) and click 'Next/Forward', the RadRotator will move back to it Item 1 (index of 0)  - It is after all a rotator/carousel!
    Is there any way to achieve (either in the RadControl properties or Code-behind) it such that once you get to the last item you can't move back to Item 1 as it were. Either being able to detect you are on the last item and disable the 'Next/Forward' button (would be ideal) or at least not do any action if the button is clicked.
    Look forward to any responses/suggestions.
    Regards,
    Praveen.
  2. Praveen Pawar
    Praveen Pawar avatar
    4 posts
    Member since:
    Jan 2010

    Posted 02 Mar 2010 Link to this post

    Hi,

    I'd like post a related question. If this one can be resolved, then I'm not too concerned about what I asked in the earlier post about hiding/disabling navigation buttons.

    In my code, I show 2 items/thumbs at a time. I have a checkbox next to each item that causes a postback. Therefore I need to maintain the selected index using javascript and hidden html field and on page load in the code-behind, I need to set the correct selected item back. I do this as follows:

     

    if (Request.Params["txtSelectedHeaderId"] != null && Request.Params["txtSelectedHeaderId"].ToString() != "")

     

    {

     

        string txtSelectedHeaderId = Request.Params["txtSelectedHeaderId"];

     

     

        int intListIndex = Convert.ToInt32(txtSelectedHeaderId.Substring(17, txtSelectedHeaderId.LastIndexOf("_") - 17));

     

     

        if ((intListIndex % 2) == 0)

     

            rrSearchResults.InitialItemIndex = intListIndex;

     

        else

     

            rrSearchResults.InitialItemIndex = intListIndex - 1;

     

    }

    As you can see if the saved item index is an even number, I set the RadRotator's InitialItemIndex to the saved value. If the saved item index is an odd number, I minus one. So index 0 and 1 should share the same InitialIteamIndex, so should 2 and 3 , 4 and 5 and so on and so forth.

    Now this completely works fine when the number of items is an even number (based on a search). However, the problem comes in when the no of items is odd. So if the number of items is 5, the indexes would look like this [0 1]   [2 3]   [4 0]   [2 3] and it goes on....

    If you click on the 2nd '0' index item, my above piece of code won't work properly. It will show [0 1] instead of remainig at [4 0] - it will not just select the item but also serve navigate across - which is clearly not the intention.

    Does anyone have a suggestion to work around this? Unfortunately, there's no way to determine which is the left and right item in view (as opposed to relying on the index value) in order to determine how to set the InitialItemIndex on postback.

    Regards,
    Praveen.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 03 Mar 2010 Link to this post

    To answer your first question. To disable the "wrapping" feature just set the property WrapFrames="false" on the RadRotator control.
  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 04 Mar 2010 Link to this post

    Hello Praveen,

    In reference to your questions;
    • The WrapFrames="false" setting  will cause the RadRotator control to stop when the last item is 
    • I prepared a demo that shows how to maintain the position of the rotator's items and attached it to this thread. Could you please check it and let me know whether it fits your requirements?

    I hope this helps.

    Greetings,
    Fiko
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top