ASP.NET - updateprogress in pageload - Asked By msakt on 23-May-12 06:10 AM

in page laod have 4 function so take  more time...during page load i display some loading message how?
Somesh Yadav replied to msakt on 23-May-12 07:00 AM

Create a normal div that shows the Ajax.gif so it shows "processing" by default.

In the javascript pageLoad() function, make a call back to the page using Ajax's PageMethods.

   function pageLoad(sender, args) {

The method you are calling in your .aspx.cs file has to be static, it can take parameters and looks something like:

public static string getVersions()
StringBuilder sb = new StringBuilder();
... etc.
return sb.ToString();


The javascript function that you specified when you called the method will run when the method completes. It will be passed the results. At the end of this function you hide the Ajax.gif div.

   function LoadVersionsCallback(result) {
// do something with the results - I load a dropdown list box.

// here is where you hide your div holding the Ajax.gif  


And then you work on making whatever it is you are doing run in less than 1 second....

Jitendra Faye replied to msakt on 23-May-12 09:52 AM

Use UpdateProgress like this-


    <form id="form1" runat="server">

      <asp:ScriptManager ID="ScriptManager1" runat="server" />

      <asp:UpdateProgress runat="server" id="PageUpdateProgress">





      <asp:UpdatePanel runat="server" id="Panel">


          <asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />





The following method should be added to your CodeBehind file:

protected void UpdateButton_Click(object sender, EventArgs e)




Hope this will help you.