title: Problems using UpdateProgress
body: <p>I have a button on my ASP.NET page, which fetches some data from my database and displays it on a gridview. </p>
  
  <p>This process takes a while, so I thought I'll add an updateprogress AJAX control. Now when I click the button, the updateprogress image shows up and data is being fetched from my database successfully (I checked this from some logs that I have in my DB). But there are 2 issues:</p>
  
  <p>(1) The updateprogress image shows only for about 2 minutes. But my buttonclick event takes about 5 minutes to complete. Basically the updateprogress stops showing up even before my task is complete, which defeats its purpose.</p>
  
  <p>(2) GridView doesn't show up. It shows up correctly if I don't use scriptmanager/AJAX.</p>
  
  <p>Any ideas?</p>
  
  <p>Some relevant code snippets:</p>
  
  <pre><code>&lt;div style="position: absolute; top: 300px; left: 19px; width: 568px; height: 48px;"&gt;
      &lt;table&gt;
          &lt;tr&gt;
          &lt;td&gt;
      &lt;asp:Button ID="btnGenerateReport" runat="server" Height="37px" Text="Generate Report" 
          Width="132px" onclick="btnGenerateReport_Click" /&gt;
          &lt;/td&gt;
          &lt;td class="style5"&gt;
      &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt;
      &lt;asp:UpdatePanel runat="server" id="Panel"&gt;
      &lt;ContentTemplate&gt;
              &lt;asp:UpdateProgress ID="PageUpdateProgress" runat="server"&gt;
                  &lt;ProgressTemplate&gt;
                      &lt;img runat="server" src="updateprogress.gif" 
                          style="position: static; width: 32px;"&gt; &lt;/img&gt;&lt;/ProgressTemplate&gt;
              &lt;/asp:UpdateProgress&gt;
              &lt;div style="position: absolute; top: 423px; left: 9px; width: 795px; height: 984px;"&gt;
          &lt;asp:GridView ID="Report" runat="server" 
              AllowSorting="True" AutoGenerateColumns="False" 
              Height="622px" BorderStyle="Solid" 
              Width="779px" PageSize="100" HorizontalAlign="Center"&gt;
              &lt;Columns&gt;
                  &lt;asp:BoundField HeaderText="AccountId" DataField="AccountId"&gt;
                  &lt;ControlStyle BorderStyle="Solid" Width="20px" /&gt;
                  &lt;/asp:BoundField&gt;
                  &lt;asp:BoundField HeaderText="User Name" ReadOnly="True" DataField="UserName"&gt;
                  &lt;ControlStyle Width="50px" /&gt;
                  &lt;/asp:BoundField&gt;
                  &lt;asp:BoundField HeaderText="C2" ReadOnly="True" 
                      DataField="C2"&gt;
                  &lt;ControlStyle BorderStyle="Solid" Width="20px" /&gt;
                  &lt;/asp:BoundField&gt;
                  &lt;asp:BoundField HeaderText="C1" ReadOnly="True" 
                      DataField="C1"&gt;
                  &lt;ControlStyle BorderStyle="Solid" Width="20px" /&gt;
                  &lt;/asp:BoundField&gt;
              &lt;/Columns&gt;
          &lt;/asp:GridView&gt;
      &lt;/div&gt;
      &lt;/ContentTemplate&gt;
      &lt;Triggers&gt;
              &lt;asp:AsyncPostBackTrigger ControlID="btnGenerateReport" EventName="click" /&gt;
      &lt;/Triggers&gt;
      &lt;/asp:UpdatePanel&gt;
          &lt;/td&gt;
          &lt;td&gt;
          &lt;asp:Button ID="btnExportToExcel" runat="server" Text="Export To Excel" 
                  Height="37px" Width="132px" onclick="btnExportToExcel_Click" /&gt;
          &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>Codefile part:</p>
  
  <pre><code>protected void btnGenerateReport_Click(object sender, EventArgs e)
          {
  
              FetchAccounts();
              long startId = FetchAuditData();
              AggregateAuditData(startId);
              dsAnalysisReport = GenerateDataSet();
              if (dsAnalysisReport == null || dsAnalysisReport.Tables.Count == 0)
                  lblErrorText.Text = "No Data Found for the input information";
              else
                  BindData(dsAnalysisReport);
          }
  
          public void FetchAccounts()
          {
              using (var sqlConnection = new SqlConnection(ConnectionString))
              {
                  sqlConnection.Open();
                  cmdstring = @"[spo_FetchAccounts]";
                  cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
                  cmd.CommandTimeout = 100000;
                  cmd.Parameters.Add("@MaxActivationDate", SqlDbType.DateTime);
                  cmd.Parameters["@MaxActivationDate"].Value =
                      DateTime.Parse(txtStartDate.Text) - new TimeSpan(1, 0, 0, 0);
                  cmd.ExecuteNonQuery();
                  sqlConnection.Close();
              }
          }
  
          public long FetchAuditData()
          {
              using (var sqlConnection = new SqlConnection(ConnectionString))
              {
                  sqlConnection.Open(); 
                  cmdstring = @"[spo_GetComparisonData]";
                  cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
                  cmd.CommandTimeout = 100000;
                  cmd.Parameters.Add("@StartDate", SqlDbType.DateTime);
                  cmd.Parameters["@StartDate"].Value = txtStartDate.Text;
                  cmd.Parameters.Add("@EndDate", SqlDbType.DateTime);
                  cmd.Parameters["@EndDate"].Value = txtEndDate.Text;
                  SqlParameter returnValue = new SqlParameter("@Return_Value", SqlDbType.BigInt);
                  returnValue.Direction = ParameterDirection.ReturnValue;
                  cmd.Parameters.Add(returnValue);
                  cmd.ExecuteNonQuery();
                  long startId = long.Parse(cmd.Parameters["@Return_Value"].Value.ToString());
                  sqlConnection.Close();
                  return startId;
              }
          }
  
          private void AggregateAuditData(long startId)
          {
              using (var sqlConnection = new SqlConnection(ConnectionString))
              {
                  sqlConnection.Open();
                  cmdstring = @"[spo_ComparisonTable]";
                  cmd = new SqlCommand(cmdstring, sqlConnection) { CommandType = CommandType.StoredProcedure };
                  cmd.CommandTimeout = 100000;
                  cmd.Parameters.Add("@StartId", SqlDbType.Int);
                  cmd.Parameters["@StartId"].Value = startId;
                  cmd.ExecuteNonQuery();
                  sqlConnection.Close();
              }
          }
  
  
          public DataSet GenerateDataSet()
          {
  
              using (var sqlConnection = new SqlConnection(ConnectionString))
              {
                  sqlConnection.Open();
                  cmdstring = @"SELECT * FROM XAccounts";
                  cmd = new SqlCommand(cmdstring, sqlConnection);
                  DataSet ds = new DataSet();
                  SqlDataAdapter da = new SqlDataAdapter(cmd);
                  da.Fill(ds);
                  sqlConnection.Close();
                  if (ds.Tables.Count &gt; 0 &amp;&amp; ds.Tables[0].Rows.Count &gt; 0)
                      return ds;
                  return null;
              }    
          }
  
          private void BindData(DataSet ds)
          {
              BindReportGrid(Report, ds.Tables[0]);
          }
  
          private void BindReportGrid(GridView gridToBind, DataTable dataTableToBind)
          {
              gridToBind.DataSource = dataTableToBind;
              gridToBind.DataBind();
          }
  </code></pre>