ListView - client side rebind call not working correctly

5 posts, 1 answers
  1. Felipe Casanova
    Felipe Casanova avatar
    56 posts
    Member since:
    Feb 2010

    Posted 20 Jul 2011 Link to this post

    I have two RadListViews on a page. I have a client side call to do some processing via AJAX and after this I call the .rebind() method on both ListViews. However, only one of the list views is refreshed properly - whichever one is called second.
    If I reload the page, both listviews refresh correctly.
    Seems like odd behaviour as I've used this elsewhere without any problems, is there an issue with having two on a page that could be causing the problem?
    I'm using a RadAjaxManager as well with each ListView targeting itself as the updated control.
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 25 Jul 2011 Link to this post

    Hello Matt,

    The rebind() client-side method of RadListView invokes postback/callback because it supports server-side binding only. So by invoking ajax request, and calling rebind() for both RadListView controls means that you are invoking three simultaneous posts to the server. However most of the browsers can handle only one post to the server at the same time. Therefore I suggest that you call the rebind method on the server instead in case you already invoked a request to it.

    Greetings,
    Iana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Felipe Casanova
    Felipe Casanova avatar
    56 posts
    Member since:
    Feb 2010

    Posted 25 Jul 2011 Link to this post

    My problem is I need to do the rebind() on the client side as it has to come after I do an AJAX call to do some processing.
    I tried adding a call to rebind the second grid in the first grid's NeedDataSource() event but this didn't work.
    Any other possible work arounds I could try?
  5. Answer
    Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 25 Jul 2011 Link to this post

    Hi Matt,

    In this case, at the end of the AjaxRequest event handler you can register startup script, through the ScriptManager.RegisterStartupScript() method, which will be invoke another ajax request and in it you can rebind both the grid. In this case you might need to set both the RadListView controls as updated from the RadAjaxManager in the ajax settings
    Note that in the javascript you cannot invoke to subsequent calls which invoke postback in your javascript. Because when the first execute, the page will be disposed and the second call will to happen.

    Give it a try and let me know how it goes.

    Regards,
    Iana
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

  6. Felipe Casanova
    Felipe Casanova avatar
    56 posts
    Member since:
    Feb 2010

    Posted 25 Jul 2011 Link to this post

    Thanks Iana, I was able to get it to work by using the client side ajaxRequest method and calling the rebind methods server side in the AjaxRequest event handler. I didn't need to register startup script or anything.

    Perhaps it would be useful if in client side methods like rebind() it had its own onSuccess event so you could chain events after completion of the asychronous call.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017