Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello all,
I followed this article to show loading image while the grid loads.
Display loading image while PostBack calls in ASP.Net[^]

I have two buttons on my page . one is for loading the grid and the other is for downloading the records in csv format.

It works fine for the loading part. but if i download it continues to show me the loading image. what should i do to get rid of this ??

this is the function. As you can see on form submitt showprogress function is called. but for download the loading image dosen't disappear as is the case with filling grid.

JavaScript
function ShowProgress() {
        setTimeout(function () {
            var modal = $('<div />');
            modal.addClass("modal");
            $('body').append(modal);
            var loading = $(".loading");
            loading.show();
            var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
            var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
            loading.css({ top: top, left: left });
        }, 200);
    }
    $('form').live("submit", function () {
        ShowProgress();
    });
Posted
Updated 29-Dec-15 23:10pm
v2
Comments
Sinisa Hajnal 30-Dec-15 3:39am    
So, when you click download button, progress shows on the screen, but does not disappear, right? Do you get any errors in the console?
Riya-Pandey 30-Dec-15 4:09am    
yes. in case of download it doesn't disappears but in case of load it does. No error on console.
[no name] 4-Jan-16 7:14am    
Hi, I am not sure but you can add a fake delay like used in the post you refer while clicked on downloading. probably it will help!

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