views:

493

answers:

2

I have an update panel in a repeater

(Edit: I removed Runat and Id attributes to make the post look cleaner)

<asp:Repeater>
    <ItemTemplate>
        <asp:UpdatePanel UpdateMode="Conditional">
            <ContentTemplate>
                 <asp:LinkButton onclick="btnCallback_Click" />
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress DisplayAfter="0">
            <ProgressTemplate>
                <img src="spinningProgress.gif" />
            </ProgressTemplate>
        </asp:UpdateProgress>
    </ItemTemplate>
</asp:Repeater>

The idea is here that you click the LinkButton and it calls back and performs a server side action for that data item. This works perfectly fine for one item. However, if I click the button for every item without waiting for the previous update panel to finish the call back, it appears to cancel the previous callback.

Can UpdatePanels not perform call backs at the same time? Is there anyway I can make it so you don't need to wait before clicking on the next button?

+2  A: 

Every AJAX request performed via UpdatePanel cancels any previous one (if previous is still running). This is how it is built. UpdatePanel AJAX request passes portions of ViewState along with request. It is impossible (at least very hard) to reconcile multiple arbitrary viewstates brought back by concurrent ajax calls. I heard that this was the primary reason MS chose to build it that way.

EDIT: use jQuery and have fun :-)

Valentin Vasiliev
Crap, I was really hoping not to hear that... I think I will use jQuery to disable the other buttons until a request is finished. Thansk!
A: 

I had the same problem before. But i finded out that making some tricks can allow you to implement multiple ajax calbacks in different microsoft update panels.

function ProcessCallBack(uniqID)

{

 var prm = Sys.WebForms.PageRequestManager.getInstance();
 //checking if there is somewhere perforimg of callback
 if (prm.get_isInAsyncPostBack()) 
 {
    setTimeout("ProcessCallBack()", 1000); //here we move execution of callback 
        //for 1 sec forward
 }
 else
 {
    __doPostBack(uniqID,'');
 }

return false; }

So you must add calling of that function to your button or control on client-side click. uniqID is the unique identifier of server control, you can get it on server side. So enjoy, and remember that everything is possible, but for some is needed a lot of time todo :-) I was thinking about that, why guys from microsoft didn't implement such thing :-)