locked
Crystal Report viewer navigation buttons not working RRS feed

  • Question

  • User-1066573097 posted

    Working in Visual Studio 2008 and using the packaged Cystal Reports (version 10.5). I have a couple pages that use the Crystal Reports Viewer to display the reports, and I use the CRV navigation buttons to page through large reports.

    Problem: The Next button only goes to page 2. The Previous button goes to Page 1 every time.

    I've read that this is because the binding of the report occurs in the Page_Load() and the CRV paging resets every time the report is rebinded. It was suggested to move this into Page_Init() which should only fire once, save the report in Session state, and then rebind on post backs. I've tried this, but my code never seems to reach the Page_Init(). In fact, I don't even see Page_Init() as an option. I've tried protected override OnInit(), but it fires every post back so that's no good.

    Does anyone have suggestions for a solution?

    Where is Page_Init() in Visual Studio 2008?

     Thanks for any help.

     -Robert

     

     

    Thursday, May 8, 2008 9:31 AM

All replies

  • User-1066573097 posted

    OK, I found the Page_Init() issue...I manually add the event, but I forgot to wire it up in the InitializeCompnent() with this.Init += new System.EventHandler(this.Page_Init).

    Now I'll see if I can get the nav buttons working by moving the report binding into there....

     

    Thursday, May 8, 2008 9:52 AM
  • User-1066573097 posted

    OK, it took some fiddling, but moving the code to Page_Init() seems to work. Now I can navigate correctly.

    To recap, I was getting my dataset, binding it to the report, and binding the report to the viewer, all in Page_Load. I moved that to Page_Init() and the viewer's navigation buttons work (Next and Previous specifically).

    Hope it helps someone.

     

     

    Thursday, May 8, 2008 12:45 PM
  • User-1321740255 posted

    Dear Robarahz

     

    Hope it helps someone.

     Thank you a lot.  It helped me to fix up the same issue.

    Friday, January 16, 2009 10:48 PM
  • User1841784631 posted
    i ve put all of binding logic in page_init method but haven't got desired results. i.e. i can come from page 1 to 2 but not on page 3 by hitting next button. kindly if u can help me out by some sample code/Reference.
    Thursday, January 22, 2009 1:34 AM
  • User1952735642 posted

     did you call report binding inside Not Page.IsPostBack ? like

            If Not Page.IsPostBack Then
                'call report
            End If

     

    Friday, January 23, 2009 2:00 PM
  • User-94304275 posted

    I was facing the same issue. I resolved my issue by Turning the View State on. In my case the view state was turned off for all pages of the website using the web.config.

    i ve put all of binding logic in page_init method but haven't got desired results. i.e. i can come from page 1 to 2 but not on page 3 by hitting next button. kindly if u can help me out by some sample code/Reference.

    Wednesday, September 9, 2009 4:11 AM
  • User1340724837 posted

    Thanx man, it helped me a lot too...


    the sample code in C# is something like so...


     protected void Page_Init(object sender, EventArgs e)
            {
                if (!IsPostBack)
                {
                     // do all your reporting stuff here, then add it to session like so
                     ReportDocument crystalReportDocument = new ReportDocumment();
                     crystalReportDocument.SetDataSource(DataTableHere);
                      //_reportViewer is the crystalviewer which you have on ur aspx form
                     _reportViewer.ReportSource = crystalReportDocument;
                     Session["ReportDocument"] = crystalReportDocument;
                }
                else
                {
                      ReportDocument doc = (ReportDocument)Session["ReportDocument"];
                      _reportViewer.ReportSource = doc;
                }
           }
           

    hope this helps


    Wednesday, May 26, 2010 11:50 AM
  • User-1494296299 posted

    Thanks guys it solved my problem too.

    i also faced the same problem with navigation

    Thursday, July 29, 2010 5:16 AM
  • User616231999 posted

    Hi everybody.

    I was having the same problem, and I solved it installing the Crystal Reports for VS 2008 SP1.

    the name of the file is crbasic2008sp1.exe and can be downloaded from the following link:

    https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe

     

    I hope this can help somebody.

    Thanks,

    Al 

    Monday, September 13, 2010 4:32 PM
  • User-1465515278 posted

    Al,

    Thank you so much!

    I downloaded the CR SP1 for VS2008 as you stated and now my page advances the correctly. 

     

    Wednesday, December 22, 2010 12:24 PM
  • User956193089 posted

    Thanks

    My Problem Is Solved.................................................Abdul1585

    Wednesday, June 20, 2012 8:15 AM
  • User-326778556 posted

    Hi Agraspnet

          I installed the exe which you specified ,for me all the navigation button is working fine,except "Last" navigation button,I can click next,Previous and First and go to last page also,but if I click Last button it refreshes and remain in same page,You have any idea how can I solve it.

    Thanks

    Ashish S

    Thursday, May 30, 2013 7:29 AM
  • User-1915554759 posted

    Page_Init worked for me. Thanks :-)

    Friday, April 11, 2014 3:04 AM
  • User-447596925 posted

    I am facing this issue since year 2008, 

    today i am very very happy

    thank you so much bro.

    give me your contact no.

    Friday, January 31, 2020 1:32 PM