Click here to Skip to main content
13,049,233 members (73,297 online)
Rate this:
Please Sign up or sign in to vote.
See more:
if I click next, it goes to 2 page, but when I click next again, it is still in 2 page, never can pass page 2. But I can go to last page. If I click previous button, it always goes to 1 page. why it happen? plz help me to sort out this problem thnax in advance :(

private void ConfigureCrystalReports()
            string str = "SELECT cast(A_formthreeA.EST_CODE as nvarchar(12)) as EST_CODE, cast(A_formthreeA.EMP_NO as nvarchar(12)) as EMP_NO, A_formthreeA.TOTWAGES, A_formthreeA.PFT, A_formthreeA.TOTEE, A_formthreeA.TOTER, A_formthreeA.EMP_NAME,A_formthreeA.FinYr, company_details.company_name,";
             str += "company_details.comp_address1, company_details.comp_address2,company_details.pf_city_init, company_details.pf_state_init ";
            str += " FROM A_formthreeA INNER JOIN company_details ON A_formthreeA.EST_CODE = company_details.pf_Code ";
            TextObject txtFrom, txtTo;
            SqlCommand cmd = new SqlCommand(str, con);
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            rpt.Load(Server.MapPath("..") + "\\Report\\form6A.rpt");
            rpt.SetDatabaseLogon("sa", "Gnk1961", "SUPER/SQLEXPRESS", "Dummy");
            txtFrom = (TextObject)rpt.ReportDefinition.ReportObjects["txtFrom"];
            txtTo = (TextObject)rpt.ReportDefinition.ReportObjects["txtTo"];
            rpt.SetParameterValue("est_code", drp_compname.SelectedValue.Trim());
            rpt.SetParameterValue("finyr", txt_year.Text);
            txtFrom.Text = txt_year.Text;
            if (txt_year.Text != "")
                txtTo.Text = Convert.ToString(Convert.ToInt16(txt_year.Text) + 1);
        catch(Exception e)
Posted 27-Feb-11 0:07am
Updated 27-Feb-11 3:55am
Mohammad Al Hoss 27-Feb-11 6:10am
Please post the code that binds the report
sandeep3 27-Feb-11 6:30am
i submit the code plz check out
sandeep3 27-Feb-11 6:48am
Actully i done that also i move that method in to page init then also not working ,is their any connection problem. plz help me
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If you are calling the method ConfigureCrystalReports() in the page load move it to the page init and your paging should work fine.
email me if it did not work.
Mohammad Al Hoss 27-Feb-11 12:25pm
1- why you are setting the login info if you are setting the datasource as datatble
2-save the rpt object in a viewstate or session then on init event give it to the crystal report viewer.
crystalreportviewer1.reportsource = (reportdocument) viewstate["rpt"];
if also did not work send me the class to check what is going on wrong.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Putting the code in the Page_Init resolved my problem.

If didn´t work send an email for me: I´m from Brazil and I´ll try to help you.
Comments 27-Jun-13 1:43am
i have put my code in pageinit but it still not working...

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170713.1 | Last Updated 15 Jun 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100