deepa ashwi

deepa ashwi

  • NA
  • 109
  • 602.1k

clicking export button in report not functioning in server

Jul 13 2013 6:37 AM






try

{

con.Open();



Report1.Load(Server.MapPath(



ReportDocument Report1 = new ReportDocument();"~/Report/ESIReport.rpt"));connection.DoCRLogin(Report1);//// server path /.///


//FileUpload2.PostedFile.SaveAs("D:\\HostingSpaces\\usamindi1\\usamindia.com_xpG8CkX3\\wwwroot\\Payroll\\PayrollExcelFiles\\" + Path.GetFileName(FileUpload2.PostedFile.FileName) + "");



//FileInfo fileio = new FileInfo("D:\\HostingSpaces\\usamindi1\\usamindia.com_xpG8CkX3\\wwwroot\\Payroll\\PayrollExcelFiles\\" + Path.GetFileName(FileUpload2.PostedFile.FileName) + "");

Report1.ExportToDisk(

System.IO.



ExportFormatType.Excel, Server.MapPath("D:\\HostingSpaces\\usamindi1\\usamindia.com_xpG8CkX3\\wwwroot\\Payroll\\PayrollExcelFiles\\export.xls"));FileInfo file = new System.IO.FileInfo(Server.MapPath("D:\\HostingSpaces\\usamindi1\\usamindia.com_xpG8CkX3\\wwwroot\\Payroll\\PayrollExcelFiles\\export.xls"));///local path///


//Report1.ExportToDisk(ExportFormatType.Excel, Server.MapPath("download\\export.xls"));







//System.IO.FileInfo file = new System.IO.FileInfo(Server.MapPath("download\\export.xls"));

Response.AddHeader(

Response.AddHeader(

Response.ContentType =

Response.WriteFile(file.FullName);

CrystalReportViewer1.ReportSource = Report1;

CrystalReportViewer1.DataBind();

CrystalReportViewer1.RefreshReport();






}


{

Response.Write(ex.Message.ToString());

}

}

"Content-Disposition", "attachment; filename=" + file.Name);"Content-Length", file.Length.ToString());"application/octet-stream";catch (Exception ex)

Answers (1)