Created
September 24, 2012 20:02
-
-
Save jpoehls/3778025 to your computer and use it in GitHub Desktop.
Do async work in OnClientClick before OnClick PostBack event
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<asp:LinkButton ID="btnSave" OnClientClick="return prepareForSave(this);" OnClick="btnSave_Click" runat="server" Text="Save" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function prepareForSave(sender) { | |
if (!sender) return; | |
var hrefToEvalWhenFinished = sender.attributes['href'].value; // Ext.get(sender).getAttribute('href'); | |
if (hrefToEvalWhenFinished) { | |
// todo: do async work here | |
// Fire the links HREF event which will do the postback. | |
eval(hrefToEvalWhenFinished); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment