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 8055145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:18:12+00:00 2026-06-05T08:18:12+00:00

I have an aspx page that loads an RDLC report. When I load the

  • 0

I have an aspx page that loads an RDLC report.

When I load the report on a post back (i.e. by adding a button to the page that does nothing but post the page back and call the DoReport() method), the report loads fine. However, if I try to load the report directly on page load (i.e. I put the DoReport() method in Page_Load, the page seems to run endlessly, and Page_Load is called hundreds of times.

protected void Page_Load(object sender, EventArgs e)
{
    if (!string.IsNullOrEmpty(Request.QueryString["ReportID"]))
    {
        BuildReport(Convert.ToInt32(Request.QueryString["ReportID"]));
    }
}

private void BuildReport(int reportID_)
{
    Database db = DatabaseFactory.CreateDatabase();
    DataTable tbl = db.ExecuteDataSet(CommandType.Text, "select top 10 * from  TABLE_NAME").Tables[0];

    RdlcBuilder rdlcBuilder = new RdlcBuilder(reportID_); //custom class that builds the RDLC based on the report ID
    XmlDocument xmlDoc = new XmlDocument();
    Bind(rdlcBuilder.GetRdlcStream(xmlDoc), tbl);
}

private void Bind(Stream reportDefinitionStream_, DataTable dataSource_)
{
    ReportViewer1.LocalReport.DataSources.Clear();

    ReportViewer1.Width = new Unit(700);
    ReportViewer1.Height = new Unit(1200);
    ReportViewer1.LocalReport.EnableExternalImages = true;
    ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetName", dataSource_));
    ReportViewer1.LocalReport.LoadReportDefinition(reportDefinitionStream_);

}

Again – this page works fine if I call BuildReport(int reportID_) from a command button

  • 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-06-05T08:18:14+00:00Added an answer on June 5, 2026 at 8:18 am

    Assigning the Report Definition to the Report triggers another Page_Load, when the ReportViewer asynchronously populates itself (while the ‘loading’ symbol is displayed).

    Since you are assigning the report definition within every Page_Load, your code is indirectly invoking Page_Load recursively.

    A simple fix is to perform a check for IsPostBack:

    protected void Page_Load(object sender, EventArgs e)
    {
        if(IsPostBack)
            return;
        //...
        // Assign report definition.
        //...
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .aspx page that loads three separate .ascx controls to represent adding,
I have an aspx page that contains a checkbox, and a button. The button
I have a button on an aspx page that is supposed to send an
In my aspx page I have drop down list that initialy in page load
I have an aspx page that dynamically loads user controls: there is an UpdatePanel
I have a aspx page that has a UpdatePanel and a asp timer. the
I have a aspx page (details page) that needs to be loaded in a
I have an aspx page that has a @Page directive which points to a
I have an aspx page that I want to convert to an HttpHandler ,
I have created one aspx Page from that i need to access the property

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.