Crystal Report Viewer. How do I display it?

G

Guest

Hi, The first part of this code def works as i have an export function which
saves my crystal report, as a pdf, to disk. However they want to be able to
view them before deciding to save them. I have just started learning about
the CRviewer and have added the three lines at the bottom, but it fails on
showFirstPage (object not set to an instance of an object). How do i get my
report to show on the browser using the crystal report viewer (and as
importantly, in a new window)? if not can I use ExportOptions to show a pdf
not yet saved to disk?
I have found very very little help on this subject in msdn and other forums,
even books..anyone know ?

ReportDocument report = new ReportDocument();
report.Load(Server.MapPath("CrystalReportTemplates/Invoice.rpt"));
report.RecordSelectionFormula="{vueInvoice.InvoiceID} =" + invoiceid;

//attach login info to the report
TableLogOnInfo LogOn = new TableLogOnInfo(); etc etc

report.Refresh();

CrystalReportViewer viewer = new CrystalReportViewer();
viewer.ReportSource = report;
viewer.ShowFirstPage();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top