question

WebDevGuy-2021 avatar image
0 Votes"
WebDevGuy-2021 asked llaxmikant answered

UpdatePanel Query

I'm trying to create a webforms page (inside a master) that immediately displays 'loading...' text while the page content is built.

I can do this quite easily if I have a button that is first clicked to call the build method but if I call the build method in the PAGE_LOAD the page doesn't render at all until the page is built.

How would I do this?

dotnet-aspnet-webforms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @WebDevGuy-2021 ,

but if I call the build method in the PAGE_LOAD the page doesn't render at all until the page is built.


What's meanings of the page doesn't render at all until the page is built? Do you want to show "loading" text until some progress complete? How do you show the progress and monitor your page is built? Do you used !IsPostBack in the page load? Just like this:

 protected void Page_Load(object sender, EventArgs e)
         {
             if (!IsPostBack)
             {
                 build();
             }
         }

Best regards,
Yijing Sun

0 Votes 0 ·

1 Answer

llaxmikant avatar image
0 Votes"
llaxmikant answered


you can do it using jQuery

add a div in webpage or master page with id

 <div id="iconloading"></div>

use css for it, change the path of gif as per your requirement

 #iconloading {
 position: fixed;
 width: 100%;
 height: 100vh;
 background: #fff url('images/loader.gif') no-repeat center center;
 z-index: 9999;
 }

add below jQuery code in your script

<script>
jQuery(document).ready(function() {
jQuery('#iconloading').fadeOut(3000);
});
</script>

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.