Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8695

Re: When I want save crystal report as pdf file, it pop up parameter window again, make me can't save pdf

$
0
0

private ReportDocument boReportDocument = null;

 

ConnectionInfo connectionInfo = newConnectionInfo();

 

if (IsPostBack) // post back event, check if report is in session if it is view it.       
            {
                boReportDocument = (ReportDocument)Session["Report"];            // Now send the report to the viewer           
                CrystalReportViewer1.ReportSource = boReportDocument;
                Session["Report"] = null;
                CrystalReportViewer1.RefreshReport();


            }

            if (Session["Report"] == null) // Report is not in session (previously loaded) so load report, set params, view and place in session 
            {
               
                //boReportDocument = new ReportDocument();
                boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                //string rptFile = ((BaseApplicationPage)(this.Page)).Decrypt(this.Page.Request.QueryString["Name"]);
                string rptFile = this.Page.Request.QueryString["Name"];
                //string Newreport = this.Page.Request.QueryString["Newreport"];
                this.Page.Title = this.Page.Request.QueryString["Name"].Replace(".rpt", "");
                boReportDocument.Load(Server.MapPath("~/Crystal/" + rptFile));
                Session.Add("Report", boReportDocument);
                CrystalReportViewer1.ReportSource = boReportDocument;

                connectionInfo.DatabaseName = "XXXX";
                connectionInfo.UserID = "XXXX";
                connectionInfo.Password = "XXXX";
                connectionInfo.ServerName = "XXXX";

                TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo;
                foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
                {
                    tableLogOnInfo.ConnectionInfo = connectionInfo;

                }


            }
            else // Report is already loaded and in session so use it also means we never reload the report       
            {
                boReportDocument = (ReportDocument)Session["Report"];   // Now send the report to the viewer           
                CrystalReportViewer1.ReportSource = boReportDocument;

            }

 

 

this is part of my code, what do I need to change for my code in order to solve the  problem?

 

thanks

Kelvni


Viewing all articles
Browse latest Browse all 8695

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>