Crystal Report viewer built in Export button problem

asp.netcrystal-reportsvisual studio 2010

I am using VS 2010, Web application with .net 4,

I downloaded Crystal report from the website that Microsoft suggests.

I added a crystal report to my web page, dragged a CrystalReportViewer, and a button.

I put in the button_click the following code:

 ReportDocument cryRpt;
 cryRpt = new ReportDocument();
 cryRpt.Load("C:\\Users\\Yazan\\Documents\\Visual Studio 2010\\WebSites\\WebSite17\\CrystalReport.rpt");
 CrystalReportViewer1.ReportSource = cryRpt;
 CrystalReportViewer1.RefreshReport();  

So it is obvious that when the button is clicked, the CrystalReportViewer appears (showing the Crystal Report I already created).

when the export button (that is already exists in the toolbar of the CrystalReportViewer) is clicked, a window is poped up letting me choose the type of format that I want to export to, and specify which pages of the report I want to export.

When I click the export button, the page is postback, and the CrystalReportViewer disappeared, and I god my old web page (without CrystalReportViewer) containing the following message:

"Failed to export using the options you specified. Please check your options and try again."

Note that this error happens for all types of file format to export to (pdf, doc…)

Please can you help me to activate the built in export button of the CrystalReportViewer?

Thanks

Best Answer

Modify the ReportSourceID in the Crystal Reports Viewer

Related Topic