This is a migrated thread and some comments may be shown as answers.

ListView - client side rebind call not working correctly

4 Answers 177 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Felipe Casanova
Top achievements
Rank 1
Felipe Casanova asked on 20 Jul 2011, 01:38 PM
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.

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 25 Jul 2011, 10:22 AM
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!

0
Felipe Casanova
Top achievements
Rank 1
answered on 25 Jul 2011, 10:29 AM
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?
0
Accepted
Iana Tsolova
Telerik team
answered on 25 Jul 2011, 11:19 AM
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!

0
Felipe Casanova
Top achievements
Rank 1
answered on 25 Jul 2011, 03:08 PM
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.
Tags
ListView
Asked by
Felipe Casanova
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Felipe Casanova
Top achievements
Rank 1
Share this question
or