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
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