DataTable dt = new DataTable(); dt=Tray.fillProjects(); try { if (dt.Rows.Count > 0) { ReportDocument rptdoc = new ReportDocument(); rptdoc.Load(Server.MapPath("~\\Reports\\Tremor.rdlc")); rptdoc.SetDataSource(dt); crv.ReportSource = rptdoc; crv.DataBind(); ExportOptions exportOpts1 = rptdoc.ExportOptions; rptdoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rptdoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; rptdoc.ExportOptions.DestinationOptions = new DiskFileDestinationOptions(); ((DiskFileDestinationOptions)rptdoc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("Tremor.pdf"); rptdoc.Export(); rptdoc.Close(); rptdoc.Dispose(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=Tremor.pdf"); Response.WriteFile("Tremor.pdf"); Response.Flush(); Response.Close(); System.IO.File.Delete(Server.MapPath("Tremor.pdf")); } else { Page.ClientScript.RegisterStartupScript(this.GetType(),"Hello","javascript:alert('ok');",true); } } catch { } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)