Wednesday, January 29, 2014

Crystal Reports Viewer won't go past page 2

The problem may stem from setting the Crystal Report Viewer control's ReportSource during the Page_Load event. This causes the paging information to be over-written with each page load, so the "current page" is re-set to 1 when it should be at 2. As an easy solution, you can move the code that sets ReportSource into Page_Init
        protected void Page_Init(object sender, EventArgs e)
        {
            if (IsPostBack && Session["rd"] != null)
            {
                crv.ReportSource = (ReportDocument)Session["rd"];
            }
        }

No comments:

Post a Comment