Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

ASP.NET,Crystal Reports 10 - DHTML viewer printing error

Posted on 2004-10-24
7
Medium Priority
?
6,404 Views
Last Modified: 2008-01-09
ASP.NET,Crystal Reports 10 - DHTML viewer printing error

Hi, I'm developing an ASP.NET web application using Visual Studio 2003 and Crystal Reports 10.

I have a page with the DHTML CrystalReportViewer control on it. It works great, except when I try to print using the Client Side Printing button on the ASP.NET Web CrystalReportViewer, I get the following error:

"An communication error occurred. Printing will be stopped."


NOTE:
A google search revealed this document:
http://ftp1.businessobjects.com/webprod/hot_fixes/en/cr10win_en_sp1.pdf

Which documents a similar error message, and says its been fixed by a patch:
_______________________________

ADAPT00273670 Patch ID: 36163993
Description:
When a backslash character ("\") in a parameter is appended to a URL, the backslash is lost when a user attempt to print through
the ActiveX Print Control. Then, the following error appears: "Crystal Print Control. A communication error occurred. Printing will
be stopped."
The cause of the problem is that the query string is not encoded and, as a result, the backslashes are truncated.
New Behavior:
The URL is properly encoded. This problem is resolved.
_______________________________

So I have now ALREADY INSTALLED Crystal Enterprise 10 Service Pack 1. But, I still get the error. I've also installed the latest Hot fixes for Crystal 10 and for the Crystal Viewers. But, I still get the error.


ALSO NOTE:
The print button on the sample page works fine, so it's surely something in my code...?


Any ideas?

-Michael
0
Comment
Question by:M0m0nga
6 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 12396696
Post your code.

mlmcc
0
 
LVL 1

Author Comment

by:M0m0nga
ID: 12397170
Good Point mlmcc:

''''''''''''''''''''''''''''''''''''''''''''''''''''''
'PAGE
''''''''''''''''''''''''''''''''''''''''''''''''''''''
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="ReportHtml.aspx.vb" Inherits="insureIT.ReportHtml"%>
<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web, Version=10.0.3300.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
      <HEAD>
            <title>ReportHtml</title>
            <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
            <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
            <meta name="vs_defaultClientScript" content="JavaScript">
            <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
      </HEAD>
      <body style="MARGIN:1px">
            <form id="Form1" method="post" runat="server">
                  <div runat="server" id="divCrv" class="CrystalViewerFrame">
                        <CR:CrystalReportViewer id="CrystalReportViewer1" runat="server" AutoDataBind="true"></CR:CrystalReportViewer>
                  </div>
            </form>
      </body>
</HTML>








''''''''''''''''''''''''''''''''''''''''''''''''''''''
' CODE BEHIND
' uses a custom class that just returns a ready-made logged-on report (the custom class works fine
' without this printing issue in another page, so custom class is not the problem. Passing in parameters
' in URL has been ruled out as a cause too, I tried it a different way already.
''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class ReportHtml
      Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

      'This call is required by the Web Form Designer.
      <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

      End Sub
      Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
      Protected WithEvents divCrv As System.Web.UI.HtmlControls.HtmlGenericControl

      'NOTE: The following placeholder declaration is required by the Web Form Designer.
      'Do not delete or move it.
      Private designerPlaceholderDeclaration As System.Object

      Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
            'CODEGEN: This method call is required by the Web Form Designer
            'Do not modify it using the code editor.
            InitializeComponent()



      End Sub

#End Region

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim rptFilePath As String = Server.MapPath("") & "\" & ConfigurationSettings.AppSettings("reportFilePath")

            Dim report As New CustomReport(Request.QueryString)
            report.Load(rptFilePath)

            With CrystalReportViewer1
            .ReportSource = report.Report
                  .DisplayToolbar = True

                  'toolbar buttons
                  .HasPrintButton = True
                  .HasExportButton = True
                  .HasCrystalLogo = False
                  .HasRefreshButton = False
                  .HasViewList = False
                  .HasZoomFactorList = False
                  .HasToggleGroupTreeButton = False
                  .HasViewList = False
                  .HasSearchButton = False
                  .HasGotoPageButton = False
                  .HasPageNavigationButtons = False
                  .HasDrillUpButton = False

                  .DisplayGroupTree = False
                  .PageZoomFactor = 65                   

                  .PrintMode = CrystalDecisions.Web.PrintMode.ActiveX



            End With

      End Sub

End Class
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 12399735
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 42

Expert Comment

by:frodoman
ID: 12402308
listening
0
 
LVL 1

Author Comment

by:M0m0nga
ID: 12405978
ANSWER:
Solved it myself.

This error was occurring internally in the ActiveX viewer, but when I did a bit more debugging in my own ASP.NET code I discovered it was catching an error in my code.

Although the error message gave no indication of this, what was actually happening was the ActiveX print control or maybe that little launching page was posting back and forth with my code.

I stepped through and found that when I set report parameters (I was setting them from request.querystring values) I was picking up 2 extra values added to the querystring by the print control. I was sending them to the report as parameters. The report sent a "parameter not found" style error back to my code, but the crystal print control caught it, ignored the actual error, and displayed a generic error.

/* begin rant */
Sound familiar to anyone? how about the famous "Login Failed" error, that is often unrelated to logins? Has anyone else written an email to Crystal about making their error messages more descriptive? I encourage anybody who reads this to do so. It'll save thousands of programmers hours.
/* end rant */

So in the end, solutions to this error may involve simply debugging your code with a fine-tooth comb (after you've applied all the latest patches from the Crystal support site).
0
 

Accepted Solution

by:
ee_ai_construct earned 0 total points
ID: 12444892
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month13 days, 3 hours left to enroll

579 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question