Consider the sequence of events:
- You click the
LinkButton
; - You fire off an AJAX request, which will run asynchronously, and return control to the browser;
- The
LinkButton
fires a partial postback to update the UpdatePanel
; - After a few milliseconds:
- Your AJAX request completes, changes the status message, and triggers another postback;
- The
UpdatePanel
updates with the HTML returned by the server;
- Some time after that, the second postback completes, and the contents of the
UpdatePanel
are once again replaced with the content returned by the server;
Since you are only changing the status label on the client side, every time your
UpdatePanel
updates, those changes are lost.
It would seem that you don't want either postback to occur. Remove the
_doPostBack
call from your
OnSuccess
function, and either cancel the click event on the
LinkButton
, or replace it with a regular
<a>
element which doesn't cause a postback:
<div class="select">
<asp:Image ID="imgSave" runat="server" ImageUrl="" style="margin-left:10px;" />
<asp:Label runat="server" Text="" ID="lblSaveResult"/>
<a href="#" onclick="Save(); return false;">Save</a>
</div>