I have a long running aspx user control that has javascript function to display a message when the timeout has occured. I have a AnimationTarget to disable the "Submit" button (which causes the timeout if the database is busy) but when the timeout occurs, the page has to be refreshed for the button to be enabled again. Is there a way I can re-enable the button (via the javascript maybe?) without refreshing the page?
Thanks
Thanks
Code:
<cc1:UpdatePanelAnimationExtender ID="ae" runat="server" TargetControlID="UpdatePanel1">
<Animations>
<OnUpdating>
<Parallel duration="0">
<%-- <FadeOut minimumOpacity=".5" />--%>
<EnableAction AnimationTarget="btnSubmit" Enabled="false" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<EnableAction AnimationTarget="btnSubmit" Enabled="true" />
<%--<FadeIn minimumOpacity=".5" />--%>
</Parallel>
</OnUpdated>
</Animations>
</cc1:UpdatePanelAnimationExtender>
Code:
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(sender, args) {
if (args.get_error() && args.get_error().name === 'Sys.WebForms.PageRequestManagerTimeoutException') {
alert('A timeout occured. This can happen when the database is busy. Please try again in a few moments.');
// remember to set errorHandled = true to keep from getting a popup from the AJAX library itself
args.set_errorHandled(true);
}
});
</script>