Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 960209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:08:48+00:00 2026-05-16T01:08:48+00:00

I have a button on my ASP.NET page, which fetches some data from my

  • 0

I have a button on my ASP.NET page, which fetches some data from my database and displays it on a gridview.

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:

(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.

(2) GridView doesn’t show up. It shows up correctly if I don’t use scriptmanager/AJAX.

Any ideas?

Some relevant code snippets:

<div style="position: absolute; top: 300px; left: 19px; width: 568px; height: 48px;">
    <table>
        <tr>
        <td>
    <asp:Button ID="btnGenerateReport" runat="server" Height="37px" Text="Generate Report" 
        Width="132px" onclick="btnGenerateReport_Click" />
        </td>
        <td class="style5">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdatePanel runat="server" id="Panel">
    <ContentTemplate>
            <asp:UpdateProgress ID="PageUpdateProgress" runat="server">
                <ProgressTemplate>
                    <img runat="server" src="updateprogress.gif" 
                        style="position: static; width: 32px;"> </img></ProgressTemplate>
            </asp:UpdateProgress>
            <div style="position: absolute; top: 423px; left: 9px; width: 795px; height: 984px;">
        <asp:GridView ID="Report" runat="server" 
            AllowSorting="True" AutoGenerateColumns="False" 
            Height="622px" BorderStyle="Solid" 
            Width="779px" PageSize="100" HorizontalAlign="Center">
            <Columns>
                <asp:BoundField HeaderText="AccountId" DataField="AccountId">
                <ControlStyle BorderStyle="Solid" Width="20px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="User Name" ReadOnly="True" DataField="UserName">
                <ControlStyle Width="50px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="C2" ReadOnly="True" 
                    DataField="C2">
                <ControlStyle BorderStyle="Solid" Width="20px" />
                </asp:BoundField>
                <asp:BoundField HeaderText="C1" ReadOnly="True" 
                    DataField="C1">
                <ControlStyle BorderStyle="Solid" Width="20px" />
                </asp:BoundField>
            </Columns>
        </asp:GridView>
    </div>
    </ContentTemplate>
    <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnGenerateReport" EventName="click" />
    </Triggers>
    </asp:UpdatePanel>
        </td>
        <td>
        <asp:Button ID="btnExportToExcel" runat="server" Text="Export To Excel" 
                Height="37px" Width="132px" onclick="btnExportToExcel_Click" />
        </td>
        </tr>
    </table>
    </div>

Codefile part:

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 > 0 && ds.Tables[0].Rows.Count > 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();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:08:48+00:00Added an answer on May 16, 2026 at 1:08 am

    As per issue (1) most likely it is ajax timing out. Default timeout is 90 seconds. To increase that use ScriptManager’s AsyncPostBackTimeout property:

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

    If ajax call is timing out, controls on the page might not work correctly so increasing timeout might solve problem (2) as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page which has a button it it. The button click
I have an asp.net page with a button. This button generates and inserts a
I have to display yes/no button on some condition on my asp.net page ,
I have an ASP.NET page which has an asp.net button control in it. When
I have the javascript code below which disables an asp.net button during page postback.
In my ASP.Net page, i have a few link button controls which are placed
I have a button on an ASP.Net page that will call Response.Redirect back to
I have a ASP.NET page with an asp:button that is not visible. I can't
I have an ASP.NET page with a cs script file to take in data
I have a ASP.NET page which has a form on it. It also has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.