Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: CrystalReports
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 Frown | :(
 
UPDATE from OP:
private void ConfigureCrystalReports()
    {
        try
        {
            con.Open();
            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();
            da.Fill(dt);
            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.SetDataSource(dt);
            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)
        {
            e.Message.ToString();
        }
        showReport(rpt);
        con.Close();
       
    }
Posted 27-Feb-11 1:07am
Edited 27-Feb-11 4:55am
v2
Comments
Mohammad Al Hoss at 27-Feb-11 6:10am
   
Please post the code that binds the report
sandeep3 at 27-Feb-11 6:30am
   
i submit the code plz check out
sandeep3 at 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
good
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.
  Permalink  
Comments
Mohammad Al Hoss at 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.
exp:
init()
{
crystalreportviewer1.reportsource = (reportdocument) viewstate["rpt"];
}
if also did not work send me the class to check what is going on wrong.
Rate this: bad
good
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: marceloperuzzi@hotmail.com. I´m from Brazil and I´ll try to help you.
  Permalink  
Comments
a.lalitha.lali@gmail.com at 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
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 15 Jun 2011
Copyright © CodeProject, 1999-2014
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