Load fresh data after one full rotation

6 posts, 1 answers
  1. George Mariakis
    George Mariakis avatar
    7 posts
    Member since:
    Dec 2005

    Posted 17 Aug 2011 Link to this post

    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 
  2. Answer
    Slav
    Admin
    Slav avatar
    1356 posts

    Posted 23 Aug 2011 Link to this post

    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.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. George Mariakis
    George Mariakis avatar
    7 posts
    Member since:
    Dec 2005

    Posted 23 Aug 2011 Link to this post

    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
  5. George Mariakis
    George Mariakis avatar
    7 posts
    Member since:
    Dec 2005

    Posted 24 Aug 2011 Link to this post

    This solution works well for what I am trying to accomplish. Thank you.

    Regards,
    George
  6. Steve
    Steve avatar
    11 posts
    Member since:
    Jan 2011

    Posted 17 Nov 2011 Link to this post

    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?
  7. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 21 Nov 2011 Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017