OnClientItemShown event fires twice when being shown

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

    Posted 01 Aug 2014 Link to this post

    I have a RadRotator in a div at the bottom of a page in my application. The div can be hidden and shown by the user clicking a button (using jQuery slideToggle). I am using the RadRotator in the CoverFlowButtons mode. The Rotator contains a list of images and also has hidden fields containing certain pertinent data - a timeline value in particular whereby a particular "slide" should be displayed for a certain period of time before moving on to the next one. The user can choose to switch between slides manually and this all functions correctly. I discovered early on that every time the Rotator is "slid" into view (or hidden) the OnClientItemShown event gets fired. I trap the event using a flag so that it doesn't reset the timeline position to the start of that slide every time the user shows or hides the Rotator. Up until a recent Telerik update that has operated perfectly well. Unfortunately, I've applied a couple of updates to my development source recently (applied one only to get another update almost immediately so I applied that as well) before doing some further development work. But now I have found I am having a problem whereby every time the user shows or hides the Rotator the time positioning gets reset and it would appear that this is because the OnClientItemShown event is being fired twice. Can you please investigate and see if there's a problem here - I don't really want to have code round multiple executions of the event?

    The code I have in the event gets the current item using the "args.get_item()" method and then performs some further code with data read from the contents of the item but only if my "flag" is not set. While debugging my code I can see that this works perfectly but after I've run on out of the event, it executes the event again which by then has reset my flag so it thinks it is valid to perform the rest of the code.

    Any help would be greatly appreciated. I can go back to earlier versions of the Telerik controls if necessary to establish what version the problem started to occur in though I'd prefer not to have to if at all possible.

    Thanks and regards

    Paul.
  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 06 Aug 2014 Link to this post

    Hi Paul,

    I tried to reproduce the described problem by creating a RadRotator with attached handler for its ItemShown event, but to no avail. Please check the attached test sample, as well as the short demonstration clip and let me know if I am missing something. The version of UI for ASP.NET AJAX that I used is the latest one - 2014.2.724.

    It is possible that the problem at hand occurs as a result of additional logic in your implementation. Please try modifying the attached sample in order to reproduce the issue. This will allow me to inspect the problem locally and to provide a more to the point answer.

    If this is not possible, you could also prepare your own fully runnable sample and send it for further inspection.

    Regards,
    Slav
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top