can i have a asp:button to view/open a file in the browser. I can do it with a hyperlink, but i'm trying to do it with a button but can't figure out how. Any help?
Dim dfdo As New CrystalDecisions.Shared.DiskFileDestinationOptions
Dim szFilename As String
szFilename = "C:\opsFile\adobe\mypdf.pdf"
dfdo.DiskFileName = szFilename
With oRpt
.ExportOptions.ExportDestinationType = CrystalDecisions.[Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType = CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = dfdo
.Export()
End With
Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click
Response.Redirect("..\OpsFile\adobe\LogRpt_StatusPlant.pdf")
End Sub
The above code works fine. 1st part of sub writes crystal reports to pdf and writes to location on C: drive. 2nd sub handles btn click to redirect to file (it only works when I create the OpsFile as a virtual directory.
When I change the path of both subs to a different server, eg. \\myserver\adobe\filename, it doesn't work anymore. The 1st sub is within try..catch..finally clauses, but it doesn't return any exceptions. the crystal reports runs in browser but file isn't save to location.
Also tested 2nd sub with response.redirect, but it returns no file found. If I use same file path in "a href" it works fine.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.