This is a migrated thread and some comments may be shown as answers.

RadGrid Button to Open PDF document

1 Answer 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
doug
Top achievements
Rank 2
doug asked on 21 Nov 2013, 07:56 PM
I'm trying to add a button to a grid that opens a "converted" pdf file in code behind.  Everything seems to be working as far as creating the bytes but nothing opens.

code: pdfFile does have results because I saved it locally just to make sure.  It just won't open.

Dim DocumentServiceWS As New DocumentServices

Dim pdfFile As Byte()

pdfFile = DocumentServiceWS.GetDRDocumentPDF(_PRO, _DocType)

 

If Not (pdfFile Is Nothing) Then

Response.Buffer = True

Response.Clear()

Response.ContentType = "application/PDF"

Response.AddHeader("Content-Disposition:", "attachment; filename=Result.pdf")

Response.BinaryWrite(pdfFile)

Response.Flush()

Response.End()

End If

 

 

 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 26 Nov 2013, 09:36 AM
Hello Doug,

I'm not sure how this question is related to RadGrid, but you can try something like this:
Response.Clear()
Dim ms As New MemoryStream(pdfFile)
Response.ContentType = "application/pdf"
Response.AddHeader("content-disposition", "attachment;filename=Result.pdf")
Response.Buffer = True
ms.WriteTo(Response.OutputStream)
Response.End()

Regards,
Daniel
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
doug
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Share this question
or