[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now


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

Posted on 2004-10-24
Medium Priority
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."

A google search revealed this document:

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

ADAPT00273670 Patch ID: 36163993
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.

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

Any ideas?

Question by:M0m0nga
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 101

Expert Comment

ID: 12396696
Post your code.


Author Comment

ID: 12397170
Good Point mlmcc:

<%@ 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">
            <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">
      <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>

' 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.

      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)

            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
LVL 101

Expert Comment

ID: 12399735
Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

LVL 42

Expert Comment

ID: 12402308

Author Comment

ID: 12405978
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).

Accepted Solution

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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
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 …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

656 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