Skip to Content
0
Former Member
Jan 12, 2011 at 02:25 PM

Not able to get print to work in crystal report viewer

54 Views

I have followed the instructions in post

[url].NET 2005 Print issue in deployment ASP;url]

and I am not able to get things working. I am using vb 2005 / asp. The report loads fine but when I click on the "print" icon in the viewer the report dissappears from the page.

I have attched code snippet:

Web Config:

<configSections>

<sectionGroup name="businessObjects">

<sectionGroup name="crystalReports">

<section name="printControl" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" />

</sectionGroup>

</sectionGroup>

</configSections>

<businessObjects>

<crystalReports>

<printControl>

<add key="path" value="C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\crystalreportviewers115\ActiveXControls\PrintControl.cab" />

</printControl>

</crystalReports>

</businessObjects>

Markup

<asp:Panel ID="Panel3" runat="server" Height="451px" Style="left: 2px; position: relative;

top: 44px; z-index: 102;" Width="998px" ScrollBars="Both">

&nbsp;

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" EnableViewState="true" AutoDataBind="true"

Style="position: relative" HasDrillUpButton="False" HasExportButton="False" BorderColor="Silver"

BorderStyle="Groove" DisplayBottomToolbar="False" DisplayGroupTree="False" EnableDrillDown="False"

HasToggleGroupTreeButton="False" HasPrintButton = "True" HasViewList="False" ToolbarStyle-BackColor="#FFC080"

HasZoomFactorList="True" PageZoomFactor="100" Printmode="Pdf" BestFitPage="False" />

</asp:Panel>

Code Behind

Imports CrystalDecisions.CrystalReports.Engine

Imports CrystalDecisions.Shared

Imports CrystalDecisions.ReportSource

Imports CrystalDecisions.Web

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

CrystalReportViewer1.HasPrintButton = True

CrystalReportViewer1.HasZoomFactorList = True

CrystalReportViewer1.PrintMode = CrystalDecisions.Web.PrintMode.Pdf

.....

Private Sub ShowCrystalReport()

myCrystalReport1.Close()

Dim myPath As String = (Server.MapPath("ProjectDailyReport.rpt"))

myCrystalReport1.Load(myPath)

myCrystalReport1.SetDatabaseLogon(System.Configuration.ConfigurationManager.AppSettings("CrystalReport_UserId"), System.Configuration.ConfigurationManager.AppSettings("CrystalReport_Password"))

myCrystalReport1.SetParameterValue("BatchGuidNo", BatchGuid)

CrystalReportViewer1.ReportSource = myCrystalReport1

CrystalReportViewer1.SeparatePages = False

myCrystalReport1.DataSourceConnections.Clear()

.....