none
problem with crystal report viewer in Visual Studio 2005 RRS feed

  • Question

  • Hi,

    I am working on Visual Studio 2005 using C#

    I am creating report using inbuilt crystal report services

    I am using crystal report viewer on my aspx page

    When ever I run the page first time my report shows good results

    As soon as i click on the export button or pagination button or zoom drop down

    I get a blank screen please help

    If I move my code present in

    if (!Page.IsPostBack)
    {
    }

    outside then I am not able to zoom the report many times. I can do only once then I cannot do, on selectiong different zoom size it does not change

    It is loosing the parameters on selecting the any control from crystal report viewer and when I click the pagination again and again to the forward direction it stops from the second page

    Below is my code for cs and aspx code

    Please Help

    My code behind code

    protected void Page_Load(object sender, EventArgs e)
            {
               
                if (!Page.IsPostBack)
                {
                 
               

                    string strFromDate = "01/01/2007"; // txtFromDate.Text;
                    string strToDate = "01/09/2007";  //txtToDate.Text;
                    string strStattus = "0"; //DrpStatus.SelectedValue;
                    GenerateReport(strFromDate, strToDate, strStattus);
                    CrystalReportViewer1.DataBind();
                }
     
              
                
                   
            }


            protected void GenerateReport(string strFromDate, string strToDate, string strStattus)
            {
                string strreportPath = ConfigurationManager.AppSettings["reportPath"].ToString();

                string strDatabaseUsernameForReports = ConfigurationManager.AppSettings["DatabaseUsernameForReports"].ToString();
                string strDatabasePasswordForReports = ConfigurationManager.AppSettings["DatabasePasswordForReports"].ToString();
                string strDatabaseServernameForReports = ConfigurationManager.AppSettings["DatabaseServernameForReports"].ToString();
                string strDatabasenameForReports = ConfigurationManager.AppSettings["DatabasenameForReports"].ToString();

                ReportDocument report = new ReportDocument();
                report.Load(@"" + strreportPath + "StudentProgressReport_.rpt");

                report.SetDatabaseLogon(strDatabaseUsernameForReports, strDatabasePasswordForReports, strDatabaseServernameForReports, strDatabasenameForReports);
               
                report.SetParameterValue("@userName", "UserName");
               
                report.SetParameterValue("@Status", strStattus);
                report.SetParameterValue("@varStartDate", strFromDate);
                report.SetParameterValue("@varEndDate", strToDate);

                CrystalReportViewer1.ReportSource = report;

                CrystalReportViewer1.DisplayToolbar = true;
                CrystalReportViewer1.BestFitPage = true;
                CrystalReportViewer1.DisplayGroupTree = false;
                CrystalReportViewer1.EnableToolTips = true;
                CrystalReportViewer1.EnableDrillDown = false;
                CrystalReportViewer1.HasCrystalLogo = false;

                CrystalReportViewer1.HasSearchButton = false;
                CrystalReportViewer1.HasZoomFactorList = true;
               

                CrystalReportViewer1.Visible = true;
               
                CrystalReportViewer1.DataBind();

     

            }
           
            below is my aspx page the code is
           
            <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
           
           
    Please help me atthe earliest

    Friday, May 4, 2007 4:29 PM

All replies

  • Hi,

     

    Try setting AutoDataBind="false", hope it works, one more suggestion, try to set all viewer properties in aspx page rather than setting them dynamically.

     

     

    Happy programming :-)

     

    Regards,

    Abdul Azeez

    Wednesday, March 19, 2008 8:09 AM