Is there a way to disable UpdateProgress for certain async postbacks?
I have an UpdateProgress control, that shows as an overlay (using CSS) for all async events for an update panel. Now, for certain EXPAND/COLLAPSE row command e开发者_如何学Govents, i just dont want to show that updateprogress.
Is there a way?
<script type="text/javascript">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_initializeRequest(InitializeRequest);
function InitializeRequest(sender, args) {
var updateProgress = $get('UpdateProgress1');
var postBackElement = args.get_postBackElement();
if (postBackElement.id == '<%= Button1.ClientID %>') {
updateProgress.control._associatedUpdatePanelId = 'dummyId';
}
else{
updateProgress.control._associatedUpdatePanelId = null;
}
}
</script>
I found this works for me where a Response.Redirect prevents the original page being reloaded & therefore the UpdateProgress does not get turned off..
On the offending control add
OnClientClick="disableProgress()"
and then put this javascript on the page
<script type="text/javascript">
function disableProgress() {
var updateProgress = $get('<%=UpdateProgress1.ClientID%>');
var originalID = updateProgress.control._associatedUpdatePanelId;
updateProgress.control._associatedUpdatePanelId = 'dummyId';
setTimeout(function () { updateProgress.control._associatedUpdatePanelId = originalID; }, 1000);
}
</script>
This temporarily disables the UpdateProgress control and then asynchronously reactivates it client-side after 1 second.
精彩评论