Click here to Skip to main content
16,019,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a page that will contain asp:UpdateProgress when event get fire ,it will show a loading image till the process occur .its working fine but my problem is when it show loading page i am also able to click on any text box or controls same time ,so i just want to make other controls inactive till the asp:Update Progress not completed.
Thanks
Posted

1 solution

Add one script inside body tag like below....

C#
<script language="javascript" type="text/javascript">
                <!--
        var prm = Sys.WebForms.PageRequestManager.getInstance();
        function CancelAsyncPostBack() {
            if (prm.get_isInAsyncPostBack()) {
                prm.abortPostBack();
            }
        }
        prm.add_initializeRequest(InitializeRequest);
        prm.add_endRequest(EndRequest);
        var postBackElement;
        function InitializeRequest(sender, args) {
            if (prm.get_isInAsyncPostBack()) {
                args.set_cancel(true);
            }
            postBackElement = args.get_postBackElement();
            if (postBackElement.id == 'YourButtonID') {
                $("#loadingImage").css('display', 'block');
                $('#totalTable').css('opacity', '0.20');
                $('#totalTable').css('filter', 'alpha(opacity=20)');
                $('#totalTable').css('filter', '"alpha(opacity=20)"');
            }
        }
        function EndRequest(sender, args) {
            if (postBackElement.id == 'btnEdit') {
                $("#loadingImage").css('display', 'none');
                $('#totalTable').css('opacity', '1');
                $('#totalTable').css('filter', 'alpha(opacity=100)');
                $('#totalTable').css('filter', '"alpha(opacity=100)"');
            }
        }
                // -->
    </script>


Just replace "totalTable" with your table/div id which contains all page controls and "loadingImage" with the id of the image you have for loading.

Don't forget to replace "YourButtonID" with the id of the button causing the postback..

I have implemented this recently and it works also.

Refer link -

http://msdn.microsoft.com/en-us/library/bb386518.aspx[^]
 
Share this answer
 
Comments
The main theme is that, it is having two events "InitializeRequest" and "EndRequest". So, you can customize whatever you want to do when it loads till it goes off.
To make the page not accessible till the update progress runs, you have to control it by setting the opacity property...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900