Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can see the print icon in the design mode, but I can't see in the run mode.

Please see this code and give me some solution. Print icon is not showing in IE also.
ASP.NET
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

        <rsweb:ReportViewer ID="ReportViewer1"  runat="server" Width="100%" SizeToReportContent="True" Height="800px" ProcessingMode="Remote">


Button Click Event
====================
C#
ReportViewer1.ProcessingMode = ProcessingMode.Local; 
LocalReport rep = ReportViewer1.LocalReport;  

rep.ReportPath = "Reports/Test.rdlc";
ReportDataSource dsStatus = new ReportDataSource("DataSet1_test_Report", Test_Report());

rep.DataSources.Clear();
rep.DataSources.Add(dsStatus);
rep.Refresh();
Posted
Updated 3-Mar-20 15:18pm
v2

set Showprintbutton=true in crystalreportviewer

in case of Asp.net set hasprintbutton=true
 
Share this answer
 
v3
Comments
Robymon 15-Nov-11 7:09am    
I set this Showprintbutton=true
Hi,

You'll have to add your own buttons on panel control and use them. I have tried with crystal report. Using the ReportViewer you can traverse through the pages, print the report directly to printer. Generally the print and other icons are visible, but they don't work at the client side.
 
Share this answer
 
Comments
Robymon 15-Nov-11 7:10am    
Can i get some examples or code to print from client side.
The panel which shows the report.

XML
<asp:Panel ID="panReport" runat="server" CssClass="panelReport" Visible="false">
    <table style="border-collapse:collapse; width:400px;" cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td class="printtd"><asp:Button id="btPrintRep" CssClass="btprint" ToolTip="Print Report" Text="Print" runat="server" /></td>
            <td class="printtd" style="width:20px;"><asp:Button ID="btFirstPage" ToolTip="First Page" Text="<<" CssClass="btprint" runat="server" /></td>
            <td class="printtd" style="width:20px;"><asp:Button ID="btNextPage" ToolTip="Next Page" Text=">" CssClass="btprint" runat="server" /></td>
            <td class="printtd" style="width:20px;"><asp:Button ID="btPrevPage" ToolTip="Previous Page" Text="<" CssClass="btprint" runat="server" /></td>
            <td class="printtd" style="width:20px;"><asp:Button ID="btLastPage" ToolTip="Last Page" Text=">>" CssClass="btprint" runat="server" /></td>
            <td class="printtd"><asp:Button ID="btCloseRep" ToolTip="Close" Text="Close" CssClass="btprint" runat="server" /></td>
        </tr>
    </table>
</asp:Panel>



Code behind

Write this in a module

SQL
Public Report As CrystalDecisions.CrystalReports.Engine.ReportDocument = New CrystalDecisions.CrystalReports.Engine.ReportDocument
    Public CrystalReportViewer As CrystalDecisions.Web.CrystalReportViewer = New CrystalDecisions.Web.CrystalReportViewer



VB
Protected Sub btCloseRep_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btCloseRep.Click
        panReport.Visible = False
    End Sub

    Protected Sub btPrintRep_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btPrintRep.Click
        ' PRINT.
        If IsPostBack Then
            Report.PrintToPrinter(1, True, 0, 0)
            panReport.Visible = False
        End If
    End Sub

    Protected Sub btFirstPage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btFirstPage.Click
        ShowReport(AnySqlQuery, "Report.rpt", "Report.xsd", "MyReport", panReport, SomeParameter)
        CrystalReportViewer.ShowFirstPage()
    End Sub

    Protected Sub btNextPage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btNextPage.Click
        ShowReport(AnySqlQuery, "Report.rpt", "Report.xsd", "MyReport", panReport, SomeParameter)
        CrystalReportViewer.ShowNextPage()
    End Sub

    Protected Sub btPrevPage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btPrevPage.Click
        ShowReport(AnySqlQuery, "Report.rpt", "Report.xsd", "MyReport", panReport, SomeParameter)
        CrystalReportViewer.ShowPreviousPage()
    End Sub

    Protected Sub btLastPage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btLastPage.Click
        ShowReport(AnySqlQuery, "Report.rpt", "Report.xsd", "MyReport", panReport, SomeParameter)
        CrystalReportViewer.ShowLastPage()
    End Sub



' SHOW REPORT.

VB
Private Function ShowReport(ByVal sQuery As String, ByVal rptFileName As String, ByVal xsdFileName As String, ByVal sTableName As String, _
                               ByRef panReport As Panel, ByVal sParameter As String) As Boolean
        Try

            If Trim(gS_UserFullName) <> "" Then
                Dim objDataAdapter As New System.Data.SqlClient.SqlDataAdapter(sQuery, myConn)
                Dim objDataSet As New DataSet
                objDataAdapter.SelectCommand.CommandTimeout = 500
                objDataAdapter.Fill(objDataSet, sTableName)

                ' CREATE THE XML FILE IN THE BASE DIRECTORY AND LOAD THE REPORT.
                objDataSet.WriteXmlSchema(System.AppDomain.CurrentDomain.BaseDirectory() & "reports\" & xsdFileName)
                Report.Load(System.AppDomain.CurrentDomain.BaseDirectory() & "reports\" & rptFileName & "")
                Report.SetDataSource(objDataSet)                                ' SET REPORT DATA SOURCE.

                ' PASS PARAMETERS.
                Report.Refresh()
                Report.SetParameterValue("RepHeader", sReportHeader)  

                CrystalReportViewer.BorderStyle = BorderStyle.None
                CrystalReportViewer.DisplayGroupTree = False : CrystalReportViewer.DisplayToolbar = False
                CrystalReportViewer.Zoom(150)
                CrystalReportViewer.BestFitPage = False : CrystalReportViewer.HasCrystalLogo = False
                CrystalReportViewer.Width = "1180" : CrystalReportViewer.Height = "770"
                CrystalReportViewer.ReportSource = Report

                panReport.Controls.Add(CrystalReportViewer)                     ' ADD THE VIEWER WITH A PANEL CONTROL ON THE PAGE.
                panReport.Visible = True

                ShowReport = True
            End If
        Catch ex As Exception
            ShowReport = False
        Finally

        End Try
    End Function
 
Share this answer
 
 
Share this answer
 
Change Compatibility View Setting in IE.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900