Crystal Report

H

Harinder Dhamija

Hi,
I'm using the following code to Export the crystal report but it exporting
blank page.
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument oReport = new ReportDocument();
if (!Page.IsPostBack)
{
oReport.Load(Server.MapPath("Reports/rptCropSoil.rpt"));
Crtv.ReportSource = oReport;
}
ViewState["CrtvDataSource"] = oReport;
}
protected void BtnExport_Click(object sender, ImageClickEventArgs e)
{
ReportDocument oReport = new ReportDocument();
oReport = (ReportDocument)ViewState["CrtvDataSource"];
oReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response,
true, "Your Exported File Name");
}

This code is saving Blank page on my system. But if i provide the complete
code on page_load i.e.

ReportDocument oReport = new ReportDocument();
if (!Page.IsPostBack)
{
oReport.Load(Server.MapPath("Reports/rptCropSoil.rpt"));
oReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat,
Response, true, "Your Exported File Name");
}

than Working fine. But i want to perform this on Button click. Please help
me.


Thank you so much
 

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

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top