Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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 :(

UPDATE from OP:
C#
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
Updated 27-Feb-11 3:55am
v2
Comments
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

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.
 
Share this answer
 
Comments
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.
exp:
init()
{
crystalreportviewer1.reportsource = (reportdocument) viewstate["rpt"];
}
if also did not work send me the class to check what is going on wrong.
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.
 
Share this answer
 
Comments
a.lalitha.lali@gmail.com 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


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