Is there a way to disable UpdateProgress for certa

2020-02-07 06:49发布

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 events, i just dont want to show that updateprogress.

Is there a way?

2条回答
Explosion°爆炸
2楼-- · 2020-02-07 07:11

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.

查看更多
smile是对你的礼貌
3楼-- · 2020-02-07 07:16
<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>
查看更多
登录 后发表回答