Visual Studio .NET - print button in RDLC

Asked By vamsi n on 11-Jul-08 04:21 AM

Hi all

iam using asp.net2.0

iam working on Reportviewer (RDLC) where i cant get the print button unlike in RDL (in SQL reporting services) how to get the print option in RDLC. and one more thing is there are few export options in RDLC where as more export options in RDL(sql).

i set the properties of RDLC "showprintbutton = true"

pls help me

use like it

Web Star replied to vamsi n on 11-Jul-08 04:44 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();
    }