Blinking ListBox on re-bind with Ajax

2 posts, 0 answers
  1. Alex
    Alex avatar
    23 posts
    Member since:
    Nov 2013

    Posted 23 Feb 2015 Link to this post

    I have three listboxes surrounded in ajax update panels that are populated by data I grab from a webrequest to a remote server.

    On two of them, the data is returned in JSON and I parse it out by using a "For Each" to loop through the JSON add items to the listbox. The problem with my approach, I believe, is that I have to drop/clear all the items out of the listbox, and then rebind with fresh data. I do this every 3 to 5 seconds, as it is a chat-like program that needs real-time updates. Whats happening is that when moused-over, you can see items in the listbox flicker as they get rebound. I'm pretty sure it makes quite a bit of overhead, too.

    My first theory in improving it would be to make the items dump into an radlistboxitemcollection and bind the listbox to that collection with "allowautomaticupdates" enabled, but I'm not even sure thats how that works.

    Is there a better way to approach this? I can't really change how I pull the data much, just how I process it.
  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 25 Feb 2015 Link to this post

    Hi Alex,

    I suggest that you move the entire logic on the client. Populate the ListBox from a web service and rebind it on every 3-5 seconds or try to use Signal R to push notifications from the server. This way you should avoid flickering.

    Hristo Valyavicharski

    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.

Back to Top