ASP.NET - showing print option in reptviewer in asp.net

Asked By Gaurab on 01-Jul-10 12:51 AM
How to show the print option in report viewer??
Ramendra Kumar replied to Gaurab on 01-Jul-10 01:11 AM
there is already a print button in Crystal Reports, in top left side,
Santhosh N replied to Gaurab on 01-Jul-10 02:22 AM

If you have any issues in using print button of toolbar of reportviewer check this and make sure you follow those..

http://msdn.microsoft.com/en-us/library/ms251693(VS.80).aspx

Sagar P replied to Gaurab on 01-Jul-10 03:44 AM

The ReportViewer Web server control, when used with client report definition (.rdlc) files, does not provide built-in print support. Although you can use the browser print functionality, you might achieve better results if you export the report to PDF or Excel and then print from the PDF viewer or Excel.

 

For more information, see:

 

http://msdn.microsoft.com/en-us/library/ms251693(VS.80).aspx


Also check this discussion which will give you code to PRINT from your code behind on button click.....


http://www.eggheadcafe.com/community/aspnet/17/10046081/reportviewer-show-print-o.aspx

Anoop S replied to Gaurab on 01-Jul-10 10:30 AM
private void Print()
    {
      const string printerName =
       "Microsoft Office Document Image Writer";
      if (m_streams == null || m_streams.Count == 0)
        return;
      PrintDocument printDoc = new PrintDocument();
      printDoc.PrinterSettings.PrinterName = printerName;
      if (!printDoc.PrinterSettings.IsValid)
      {
        string msg = String.Format(
         "Can't find printer \"{0}\".", printerName);
        MessageBox.Show(msg, "Print Error");
        return;
      }
      printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
      printDoc.Print();
    }
    // Create a local report for Report.rdlc, load the data,
    //    export the report to an .emf file, and print it.
    private void Run()
    {
      LocalReport report = new LocalReport();
      report.ReportPath = @"..\..\Report.rdlc";
      report.DataSources.Add(
       new ReportDataSource("Sales", LoadSalesData()));
      Export(report);
      m_currentPageIndex = 0;
      Print();
    } refer http://msdn.microsoft.com/en-us/library/ms252091%28VS.80%29.aspx http://social.msdn.microsoft.com/forums/en-US/vsreportcontrols/thread/e7f833da-df5e-4b97-b900-7683dc228f92