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

RadRotator - button navigation

3 Answers 190 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
Praveen Pawar
Top achievements
Rank 1
Praveen Pawar asked on 28 Feb 2010, 06:35 AM
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.

3 Answers, 1 is accepted

Sort by
0
Praveen Pawar
Top achievements
Rank 1
answered on 02 Mar 2010, 07:59 AM
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.

0
robertw102
Top achievements
Rank 1
answered on 03 Mar 2010, 09:38 PM
To answer your first question. To disable the "wrapping" feature just set the property WrapFrames="false" on the RadRotator control.
0
Fiko
Telerik team
answered on 04 Mar 2010, 08:36 AM
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.
Tags
Rotator
Asked by
Praveen Pawar
Top achievements
Rank 1
Answers by
Praveen Pawar
Top achievements
Rank 1
robertw102
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or