Talk with the Author
 Crystal Reports Forum : General Information : Talk with the Author
Message Icon Topic: Crystal Report multiple page problem Post Reply Post New Topic
Author Message
rasadulalam
Newbie
Newbie


Joined: 01 Jun 2011
Online Status: Offline
Posts: 1
Quote rasadulalam Replybullet Topic: Crystal Report multiple page problem
    Posted: 29 Nov 2011 at 6:58am
Hi,
I can display a report by using Crystal Report and CrystalReportViewer. It working nice. But if the data are large and it takes more than on page then it shows only the first page. How can I show all the pages. Here is my code.

NB: I am using asp.net, c#


protected void Page_Load(object sender, EventArgs e)
    {
       
        string ReportName="";
        string Parameter1="";
        ReportName = Session["ReportName"].ToString();
        Parameter1 = Session["Parameter1"].ToString();
          
        ReportDocument rptDoc = new ReportDocument();
        try
        {
                    

            
            rptDoc = ShowReport(ReportName, Parameter1);           
            CrystalReportViewer1.ReportSource = rptDoc;
            CrystalReportViewer1.RefreshReport();
            CrystalReportViewer1.Visible = true;
            CrystalReportViewer1.DataBind();
            
   
        }
        catch (Exception ex)
        {
           
        }

       

    }


    #region Instantiate

    private ParameterValues crParameterValues = new ParameterValues();
    private ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
    private ReportDocument cryRpt = new ReportDocument();

    #endregion

    #region Declaration

    private string ServerName = ConfigurationManager.AppSettings["ServerName"].ToString();
    private string DatabaseName = ConfigurationManager.AppSettings["DatabaseName"].ToString();
    private string UserName = ConfigurationManager.AppSettings["UserName"].ToString();
    private string Password = ConfigurationManager.AppSettings["Password"].ToString();
    private ParameterFieldDefinitions crParameterFieldDefinitions;
    private ParameterFieldDefinition crParameterFieldDefinition;

    #endregion



    #region DatabaseLogonInfo
    ReportDocument DatabaseLogonInfo()
    {
        ReportDocument cryRpt = new ReportDocument();
        try
        {

            //string ServerName = ConfigurationManager.AppSettings["servername"].ToString();
            //string DatabaseName = ConfigurationManager.AppSettings["databasename"].ToString();
            //string UserName = ConfigurationManager.AppSettings["username"].ToString();
            //string Password = ConfigurationManager.AppSettings["password"].ToString();
            cryRpt.SetDatabaseLogon(UserName, Password, ServerName, DatabaseName);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        return cryRpt;

    }
    #endregion

   

    #region Execute report For one String type Parametar
    public ReportDocument ShowReport(string ReportName, string Parameter1)
    {
        try
        {
            //cryRpt.Refresh();                 
            cryRpt.Load(ReportName);
            cryRpt.SetDatabaseLogon(UserName, Password, ServerName, DatabaseName);
            crParameterValues.Clear();
            crParameterDiscreteValue.Value = Parameter1;// as like Parameter1
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
            crParameterFieldDefinition = crParameterFieldDefinitions["@Parameter1"];
            crParameterValues = crParameterFieldDefinition.CurrentValues;
            crParameterValues.Add(crParameterDiscreteValue);
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

        }
        catch (Exception ex)
        {
            throw ex;
            //ShowReport(@"default_report.rpt");
        }
        //CleareParameter();
        return cryRpt;
    }
    #endregion
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.033 seconds.