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

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
LVL 1
M0m0ngaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mlmccCommented:
Post your code.

mlmcc
0
M0m0ngaAuthor Commented:
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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

frodomanCommented:
listening
0
M0m0ngaAuthor Commented:
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
ee_ai_constructCommented:
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.