I need to be able to reference a dataset that is in another webform.
I'm exporting a crystal report document to pdf in my first webform which
has user selected criteria that I don't necessarily want changed. Meaning
I don't want to refresh my browser and set all the selections back to
default. But when the pdf loads it loads ontop of my webform and I lose my
back arrow, the only way to get back to my original form is to hit the
refresh button. Not a user friendly function. I would like the pdf file to
open up in a new browser window, so I put the new browser code in front of
the export code and the export code never runs and vice versa. So my
solution is to call the new browser code and put the export code in the
page_load event , but the DataSet1 is not recognized because of the new
webform. Here is my code for the page_load event.
Dim crReportDocument As ReportDocument
Dim crExportOptions As ExportOptions
Dim crDiskFileDestinationOptions As DiskFileDestinationOptions
Dim Fname As String
crReportDocument = New ReportDocument()
crReportDocument.Load("C:\Inetpub\wwwroot\item_status1
\CrystalReport1.rpt")
crReportDocument.SetDataSource(dataset1)
Fname = "c:\exports\" & Session.SessionID.ToString & ".pdf"
crDiskFileDestinationOptions = New DiskFileDestinationOptions()
crDiskFileDestinationOptions.DiskFileName = Fname
crExportOptions = crReportDocument.ExportOptions
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
crReportDocument.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
'Response.Flush()
'Response.Close()
Response.BufferOutput = True
Response.Redirect("webform3.aspx", True)
System.IO.File.Delete(Fname)
Thanks in Advance
Chris