using CrystalDecisions.CrystalReports.Engine;
protectedvoid btn_Click( object sender, EventArgs e )
{
try
{
// Get the report document
ReportDocument report = new ReportDocument();
// it was guessed that the .rpt file is under 'Reporting' folder of the project
report.Load( Server.MapPath( " /Reporting/report1.rpt" ) );
// Stop buffering the response
Response.Buffer = false;
// Clear the response content and headers
Response.ClearContent();
Response.ClearHeaders();
// Export the Report to Response stream in PDF format
report.ExportToHttpResponse( ExportFormatType.PortableDocFormat, Response, false, "My Report");
}
catch( Exception ex )
{
// use any logic to show the error, e.g. label, messageBox..
}
}