Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

How to show Page Loading div until the page has finished loading in asp.net.

Please suggest

What I have tried:

I tried using update progress but it is not working.
Posted
Updated 5-May-16 23:13pm

Show a "loading" div and use jQuery to hide the div on the document.ready event. Note it depends what you mean by "finished loading". The first task is that your code-behind runs and generates html, that html is sent to the browser and shown, the browser then loads the resources needed for that page such as images, scripts etc. As the browser hasn't been sent anything while your code-behind is running there is nothing you can do for that aspect of things, the loading div will only be shown after your code-behind and will then be hidden when all the images etc have loaded.

If it is your code-behind that is slow then you'll need to load the main content of your page using ajax so that you have a basic "loading" page returned quickly and the akax call loads the real content which takes time, and hides the loading div after.
 
Share this answer
 
You can create a class and then use fadeout method of jquery :
CSS :
CSS
.loader {
            position: fixed;
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            z-index: 9999;
            background: url('/yourimagefolder/loading.gif') 50% 50% no-repeat rgb(249,249,249);
        }


html div :

HTML
<div class="loader"></div>



Jquery :
JavaScript
$(window).load(function () {
            $(".loader").fadeOut("slow");
        });
 
Share this answer
 
v2

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