Search code examples
asp.netcrystal-reports

crystal report viewer next page not working


I am using visual studio 2010 and crystal report 13.0

The report viewer displays the first page properly. But the next page button is not working. If i click on next page button then it shows loading message and stays there only.None of the report viewer controls are working.

please help me out


Solution

  • I found the solution. Manually add the Page_Init() event and wire it up in the InitializeCompnent() with

    this.Init += new System.EventHandler(this.Page_Init).

    Move the contents of Page_Load to Page_Init().

    Add if (!IsPostBack) condition in PageInIt.

    protected void Page_Init(object sender, EventArgs e)
    {
    
            if (!IsPostBack)
            {
                 ReportDocument crystalReportDocument = new ReportDocumment();
                 crystalReportDocument.SetDataSource(DataTableHere);
                 _reportViewer.ReportSource = crystalReportDocument;
                 Session["ReportDocument"] = crystalReportDocument;
            }
            else
            {
                  ReportDocument doc = (ReportDocument)Session["ReportDocument"];
                  _reportViewer.ReportSource = doc;
            }
       }