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

Load fresh data after one full rotation

5 Answers 101 Views
Rotator
This is a migrated thread and some comments may be shown as answers.
George Mariakis
Top achievements
Rank 1
George Mariakis asked on 18 Aug 2011, 03:25 AM
I am trying to load fresh data after one full rotation of the rotator. After a full cycle completes I'd like to have an event fire to reload new data and there's no event so far as I can see to do this. The data consists of live scores for a sporting event and I'd like to use one full rotation as the trigger to refresh the data. I am using the Live XML example as my basis. Please advise on the best way to accomplish this as there's no event to signal that a rotation is complete. Clearly the rotator must know when a cycle is complete since it can wrap frames. Thank you.

Regards,
George 

5 Answers, 1 is accepted

Sort by
0
Accepted
Slav
Telerik team
answered on 23 Aug 2011, 07:50 AM
Hello George,

You can detect a full rotation by checking the index of the current item. This is achieved via the Client API of the RadRotator. Please use the following steps to implement this functionality:

1. The RadRotator has a client-side event OnClientItemShown, which is fired every time a new item is shown. It will be handled in order to perform a check on every item.

2. The index of the currently shown item is referenced via the radRotator.get_item().get_index() structure, where radRotator is the client object of the rotator. Depending on the current index, a check is performed whether the last item of the RadRotator is displayed. If this is the case, an AJAX request is sent to the server via the RadAjaxManager.

3. From the code-behind the data of the rotator is rebinded on the AjaxRequest event of the RadAjaxManager.

Please find attached a sample project, implementing the desired functionality. You may use it as a base for your further development.

Greetings,
Slav
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
George Mariakis
Top achievements
Rank 1
answered on 23 Aug 2011, 04:04 PM
Thanks for this. I'll be looking at it to see if it solves my problem. If so, I'll let you know and mark it as solved.

Thanks again.

Regards,
George
0
George Mariakis
Top achievements
Rank 1
answered on 25 Aug 2011, 04:33 AM
This solution works well for what I am trying to accomplish. Thank you.

Regards,
George
0
Steve
Top achievements
Rank 1
answered on 17 Nov 2011, 06:26 PM
This solution works, except for one thing - if there's only one item in the dataset, the ItemsShown function can't find the RadAjaxManager.  Any thoughts?
0
Slav
Telerik team
answered on 21 Nov 2011, 03:03 PM
Hello Steve,

The RadRotator control is designed to contain more elements than it can show in its ViewPort. This is why when there is only one item in the rotator control the animation doesn't start. You can handle such scenarios by adding empty items to the RadRotator in order to supply the number of items needed for the rotation to start.

I have attached a sample project that demonstrates the solution above. Please use it as a reference for handling the specific case.

All the best,
Slav
the Telerik team
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 their blog feed now
Tags
Rotator
Asked by
George Mariakis
Top achievements
Rank 1
Answers by
Slav
Telerik team
George Mariakis
Top achievements
Rank 1
Steve
Top achievements
Rank 1
Share this question
or