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

  • SEARCH
  • Home
  • 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 882861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:29:30+00:00 2026-05-15T12:29:30+00:00

I have a report that takes about 2 or 3 minutes to pull all

  • 0

I have a report that takes about 2 or 3 minutes to pull all the data

So I am trying to use ASP.net Asynch pages to prevent a timeout. But can’t get it to work

Here’s what I am doing :

private delegate List<PublishedPagesDataItem> AsyncReportDataDelegate();

private AsyncReportDataDelegate longRunningMethod;

private List<PublishedPagesDataItem> reportData;

public PublishedPagesReport() // this is the constructor
{
    reportData = new List<PublishedPagesDataItem>();
    longRunningMethod = GetReportData;
}


protected void Page_Load(object sender, EventArgs e)
{
    this.PreRenderComplete +=
        new EventHandler(Page_PreRenderComplete);

    AddOnPreRenderCompleteAsync(
        new BeginEventHandler(BeginAsynchOperation),
        new EndEventHandler(EndAsynchOperation)
    );
}

private List<PublishedPagesDataItem> GetReportData()
{
    // this is a long running method
}

private IAsyncResult BeginAsynchOperation(object sender, EventArgs e, AsyncCallback cb, object extradata)
{
    return longRunningMethod.BeginInvoke(cb, extradata);
}

private void EndAsynchOperation(IAsyncResult ar)
{
    reportData = longRunningMethod.EndInvoke(ar);
}

private void Page_PreRenderComplete(object sender, EventArgs e)
{
    reportGridView.DataSource = reportData;
    reportGridView.DataBind();
}

So I have a delegate representing the Long running method (GetReportData).

And I am trying to call it as per this article :

http://msdn.microsoft.com/en-us/magazine/cc163725.aspx

The long running method does complete in the debugger but breakpoints on the EndAsynchOperation and Page_PreRenderComplete methods never get hit

any idea what I am doing wrong?

  • 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-15T12:29:31+00:00Added an answer on May 15, 2026 at 12:29 pm

    the code below works. not sure what the difference is, except that there is a if (!IsPostBack)

    anyway, now solved

    private delegate List<PublishedPagesDataItem> AsyncReportDataDelegate();
    
    private AsyncReportDataDelegate longRunningMethod;
    
    private List<PublishedPagesDataItem> reportData;
    
    public asynchtest()
    {
        reportData = new List<PublishedPagesDataItem>();
        longRunningMethod = GetReportData;
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Hook PreRenderComplete event for data binding
            this.PreRenderComplete +=
                new EventHandler(Page_PreRenderComplete);
    
            // Register async methods
            AddOnPreRenderCompleteAsync(
                new BeginEventHandler(BeginAsyncOperation),
                new EndEventHandler(EndAsyncOperation)
            );
        }
    }
    IAsyncResult BeginAsyncOperation(object sender, EventArgs e,
        AsyncCallback cb, object state)
    {
        return longRunningMethod.BeginInvoke(cb, state);
    }
    
    void EndAsyncOperation(IAsyncResult ar)
    {
        reportData = longRunningMethod.EndInvoke(ar);
    }
    
    protected void Page_PreRenderComplete(object sender, EventArgs e)
    {
        Output.DataSource = reportData;
        Output.DataBind();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a report that is taking about 10 minutes to load when opened
I have a Perl script that takes about 30 minutes to run, so of
I have a report that is returning a one data field to a tablix
I have a report that shows all errors (if there are any) from a
The Particulars: I have a report that displays information about invoices. There is a
I have a button on my ASP.NET page, which fetches some data from my
I have a couple stored procedures that run for about 2-3 minutes a piece
I have a C# program that takes a legacy report file and maps to
I have a website(asp.net) which displays ssrs reports. Howevery everytime that I try to
We have a web application that produces reports. Data are taken from a database.

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.