Rotator OnClientItemShown not firing

3 posts, 0 answers
  1. PaulH
    PaulH avatar
    26 posts
    Member since:
    Mar 2011

    Posted 13 Jul 2012 Link to this post

    Hi there

    I'm having a problem with a RadRotator in CoverFlowButtons mode whereby the OnClientItemShown event is not firing in some cases. I have the rotator setup with a collection (List<>) of images with additional data stored in hidden fields, one of which is a time to display, in the itemtemplate of the items. I have a mechanism operating in the background which checks the items in the rotator at timed intervals and changes the current item to the correct one for the time, using the set_currentItemIndex method. This correctly moves the rotator on to the appropriate item regardless of whether it's the next, previous or one some distance away. But when the selected item displays in the rotator neither the OnClientItemShowing or OnClientItemShown events fire - which I am relying on to change a large version of the selected image. If I manually click on an item in the rotator or use the next or previous buttons of the rotator then it does correctly fire the events and everything works perfectly. Is there something else I need to do to get the OnClientItemShown (or OnClientItemShowing) event to fire? I originally declared the event in the definition of the rotator but have since changed it to call the .add_itemShown method in the OnClientLoad event but all to no avail. I'm sure I have already had this working some time ago but now I'm not so sure. I've even stripped out all code from the event just in case there was something of issue in the code but that's made no difference either. I'm currently on version 2012.2.607.40 and the page I am using is a content page using a site master, but all code is on my aspx page. The rotator is simply contained in a div and I have no ajax calls taking place or anything of the kind.

    Any suggestions?
  2. Slav
    Slav avatar
    1351 posts

    Posted 18 Jul 2012 Link to this post

    Hello Paul,

    It is expected behavior that the OnClientItemShown and OnClientItemShowing client-side events are not raised when the current item of RadRotator is set via set_currentItemIndex. Nevertheless, it is logical that these events are fired in the discussed scenario. We will consider changing this behavior in a future release of RadControls for ASP.NET AJAX, although currently I cannot provide a firm estimate when this will be done.

    Is it possible that you wrap the part of your logic, which you need to execute when a new item is displayed, in a function so that you can call it both in the OnClientItemShown/OnClientItemShowing event handler and when the set_currentItemIndex method is used?

    All the best,
    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.
  3. DevCraft R3 2016 release webinar banner
  4. PaulH
    PaulH avatar
    26 posts
    Member since:
    Mar 2011

    Posted 18 Jul 2012 Link to this post

    Hi Slav and thanks for the response.

    I realised that it was unlikely that the situation would have a rapid resolution so I made some changes to store an array of information separately in the javascript of the page which I populate in the ClientLoad event so when I set the currentItemIndex I get the data I want from that rather than from the newly selected item in the Rotator. Ultimately, I'm now getting the right result though I agree with you that it would be logical that whenever a new item is shown (and is about to be shown) the events should fire regardless of what mechanism is used to make the switch.

    Thanks again.
Back to Top