title: How to display progress bar until whole aspx is loading in asp.net c#
body: <p>i want to display the progress bar until whole .aspx is loading in asp.netc#
   but it is not working please help me out.progress bar is complete while page is loading.but i want How to show progress bar on web page until web page is fully loaded? on button click.
          
                          var size = 2;
                          var id = 0;</p>
  
  <pre><code>                    function ProgressBar() {
  
  
                              document.getElementById("divProgress").style.display = "block";
                              document.getElementById("divUpload").style.display = "block";
                              id = setInterval("progress()", 20);
                              return true;
                          }
  
  
                      function progress() {
                          size = size + 1;
                          if (size &gt; 299) {
                              clearTimeout(id);
                          }
                          document.getElementById("divProgress").style.width = size + "pt";
                          document.getElementById("&lt;%=lblPercentage.ClientID %&gt;").firstChild.data = parseInt(size / 3) + "%";
                      }
  
                  &lt;/script&gt;
  
          &lt;body&gt;
              &lt;form id="form1" runat="server"&gt;
                  &lt;div&gt;
                      &lt;asp:FileUpload ID="FU_IncomingFile"runat="server"/&gt;
                      &lt;asp:Label ID="lblPercentage" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
                  &lt;/div&gt;
                  &lt;asp:Button ID="btnUpload" runat="server" CssClass="btn btn-sm theme-blue theme-red theme-pink theme-orange theme-cyan theme-green" Text="Upload" OnClientClick="return ProgressBar()" OnClick="btnUpload_Click" /&gt;
                  &lt;div id="divUpload" style="display: none"&gt;
                      &lt;div style="width: 300pt; text-align: center;"&gt;
                          Uploading...
                      &lt;/div&gt;
                      &lt;div style="width: 300pt; height: 20px; border: solid 1pt gray"&gt;
                          &lt;div id="divProgress" runat="server" style="width: 1pt; height: 20px; background-color: orange; display: none"&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div style="width: 300pt; text-align: center;"&gt;
                          &lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
                      &lt;/div&gt;
                      &lt;br /&gt;
                      &lt;asp:Label ID="Label2" runat="server" ForeColor="Red" Text=""&gt;&lt;/asp:Label&gt;
                  &lt;/div&gt;
  
  
   protected void btnUpload_Click(object sender, EventArgs e)
      {
          System.Threading.Thread.Sleep(8000);
          Label1.Text = "Upload successfull!";
      }
  </code></pre>