ASP.NET AJAX using UpdatePanels
Conceptually, my understanding of AJAX is requests sent to the server asynchronously aka in parallel. When I use multiple UpdatePanels
on a page and trigger multiple async postbacks (say by using a button), I notice that the second request is not started till the first one is complete.
However when I use JQuery ajax and use PageMethods
/WebMethods
, my requests are processed in parallel.
Why is there a discrepency in the way ASP.NET AJAX behaves?
Also, when I click th开发者_StackOverflowe button in the UpdatePanel repeatedly, it aborts previous requests. I was expecting them to be queued.
any help?
Because it must behave that way.
An UpdatePanel's asynchronous postback is still just that: a postback. If multiple postbacks were allowed to occur in parallel, their new ViewStates would often be out of sync with each other. Then, the very next postback would throw a ViewState validation error and/or one of the postbacks' modifications to the Page's state would be lost after the third postback completed.
On the other hand, page method and web service calls are not encumbered by the WebForms ViewState or page life cycle. So, as many of those may occur in parallel as the browser's simultaneous request limit allows (usually 4-8, but only 2 in some browsers like IE6).
This blog post seems like it addresses your problem and provides a solution. He uses some javascript to queue multiple requests and sends them to the server in a batch (I think).
精彩评论