SAP Knowledge Base Article - Public

1215387 - Clicking next page button on Web Forms Viewer returns empty page in VS .NET


When running a web application which uses Crystal Reports for Visual Studio .NET, the Web Forms Viewer contains a command button that loads a report by setting the 'ReportSource' property to the report document.  When the command button is clicked, the 'Visible' property of the viewer is set to 'True' and the first page of the report is displayed in the browser.  However, when using the navigation button to go to the next page, no data is displayed.  Why does data only appear on the first page of the report?

Note: This issue can also occur when using Java.



  • Crystal Reports for Visual Studio ASP.NET application
  • Crystal Reports for Eclipse


This issue can occur if the 'ReportSource' property for the Web Forms Viewer is set in an event (such as a Button_Click event) which is not executed on successive postbacks to the Web Forms Viewer page . 


To resolve this issue, set the 'ReportSource' property in an event where the page request is a postback (such as the Page_Load event in a .NET app)

Example .NET code: 

(This code ensures that the 'ReportSource' property for the viewer control is set for every postback to the Web Forms Viewer)

 public partial class _Default : System.Web.UI.Page
        CrystalDecisions.CrystalReports.Engine.ReportDocument rd;
        CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;

    protected void Page_Init(object sender, EventArgs e)
        rd = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
        CrystalDecisions.CrystalReports.Engine.Database crDatabase;
        CrystalDecisions.CrystalReports.Engine.Tables crTables;
        CrystalDecisions.Shared.TableLogOnInfo tblogoninfo;
        CrystalDecisions.Shared.ConnectionInfo cninfo;
        string url = @"D:/Atest/reports/MyReport.rpt";
        rd.FileName = url;

        #region Session
        if (Session["rd"] == null)
                rd.Load(url, OpenReportMethod.OpenReportByTempCopy);
                rptClientDoc = (CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper)rd.ReportClientDocument;
                // not using RAS then use
                // Session.Add("rd", rd);
                Session.Add("rd", rptClientDoc.ReportSource);
                // open the database connection
                //rptClientDoc = rd.ReportClientDocument;

        #endregion Session

        CrystalReportViewer1.Height = 300;
        CrystalReportViewer1.Width = 300;
        CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None;

        // set up the format export types:
        int myFOpts = (int)(
            CrystalDecisions.Shared.ViewerExportFormats.RptFormat |
            CrystalDecisions.Shared.ViewerExportFormats.PdfFormat |
            CrystalDecisions.Shared.ViewerExportFormats.RptrFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.CsvFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.EditableRtfFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.RtfFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.WordFormat |
            CrystalDecisions.Shared.ViewerExportFormats.XmlFormat |
            CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat |
            //CrystalDecisions.Shared.ViewerExportFormats.AllFormats |

        //CrystalDecisions.Shared.ViewerExportFormats.NoFormat); // no exports allowed
        //int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);

        CrystalReportViewer1.AllowedExportFormats = myFOpts;
        CrystalReportViewer1.ID = "ReportUsageDetailByArea";

       // this sets the report to the session
       if (!IsPostBack)
          CrystalReportViewer1.ReportSource = rd;
          CrystalReportViewer1.ReportSource = Session["rd"];

        CrystalReportViewer1.EnableParameterPrompt = true;
        CrystalReportViewer1.HasToggleParameterPanelButton = true;

        // May have to do this in the On Form_Close close and dispose of the report and Session.


Example Java Code:

<%@ page import=",,,,""

String reportPath;
Object reportSource;
ReportClientDocument reportClientDocument;
CrystalReportViewer crystalReportViewer;

if (session.getAttribute("ReportSource")== null) {
 reportPath = "<path to Report>";
 reportClientDocument = new ReportClientDocument();
 reportClientDocument.setReportAppServer(ReportClientDocument.inprocConnectionString);, OpenReportOptions._openAsReadOnly);
 reportSource = reportClientDocument.getReportSource();
 session.setAttribute("ReportSource", reportSource);

reportSource = session.getAttribute("ReportSource");

crystalReportViewer = new CrystalReportViewer();
crystalReportViewer.processHttpRequest(request, response, getServletContext(), null);



DOTNET ASP.NET NAVIGATE NEXT PAGE BLANK EMPTY VIEWER POST BACK .NET VS.NET Crystal Reports for Visual Studio Preview report No data on second page , c2012164 java CR Eclipse postback , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , Problem


SAP Crystal Reports, developer version for Microsoft Visual Studio