Click here to Skip to main content
15,127,283 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello. I have a problem with move next page. Assume that i have 5 pages of report. I can only move from first page to second page only. whatever i click next button, page keep showing on second page. It doesn't move to 3rd page than 4th...

my code is below :
C#
private ReportDocument report;
private String reportName = "ABCrpt.rpt";

protected void NextButton_Click(object sender, EventArgs e)
        {
            this.BindReport();
            this.rptviewer.ShowNextPage();
        }


private void BindReport()
        {
            if (Session["Rep"] == null)
            {
                Hashtable Params = new Hashtable();
                Params.Add("StartDate", Convert.ToDateTime(this.StartDateFlexDevCalendar.GetDate));
                Params.Add("EndDate", Convert.ToDateTime(this.EndDateFlexDevCalendar.GetDate));

                report = new ReportDocument();
                report.Load(Server.MapPath("EN/" + reportName ));


                TableLogOnInfos tblLogonInfos = new TableLogOnInfos();
                TableLogOnInfo tblLogonInfo = new TableLogOnInfo();
                ConnectionInfo connectionInfo = new ConnectionInfo();

                connectionInfo.ServerName = "sokheng";
                connectionInfo.UserID = "sa";
                connectionInfo.Password = "1234";
                connectionInfo.DatabaseName = "DatabaseABC";


                foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in report.Database.Tables)
                {
                    tblLogonInfo = tbl.LogOnInfo;
                    tblLogonInfo.ConnectionInfo = connectionInfo;
                    tbl.ApplyLogOnInfo(tblLogonInfo);
                }

                if (Params != null)
                {
                    foreach (DictionaryEntry p in Params)
                    {
                        report.SetParameterValue(Convert.ToString(p.Key), Convert.ToDateTime(p.Value));
                    }
                }
                Session["Rep"] = report;
            }
            report = (ReportDocument)Session["Rep"];
            this.rptviewer.ReportSource = report;
            this.rptviewer.DataBind();
        }


So please help me ... what should I do to solve this problem ?
Posted
Comments
sokhengsiv 24-Mar-12 2:10am
   
I have used crystalviewer build in tool bar. but viewer will always ask to logon every time i click on "Next, Previous, First, Last" buttons. Does anyone have better solution for me ? Please help me ...

The crystal reports viewer has built in toolbar which contains the buttons to navigate the report as explained here
http://www.c-sharpcorner.com/UploadFile/mahesh/CrystalReportsViewer11082005044859AM/CrystalReportsViewer.aspx[^]
   
v3
Comments
sokhengsiv 24-Mar-12 1:53am
   
I accept with your suggestion, and i also used to it, but my report will always ask to logon every time i click 'next or previous or first or last' button on viewer tool bar. that's why i have create my own button stead of use that. so could you tell more any suggestion ?
I had the same problem and i moved the report loading code in page_init
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900