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

RadGrid PDF export to server

2 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lajos
Top achievements
Rank 1
Lajos asked on 10 Aug 2012, 07:49 PM
Hello, Telerik team, I have a question.

For a lot of hours I've tried to solve my problem. I want to export the data source of a RadGrid to a file on the server.

RadGrid1.MasterTableView.ExportToPdf()

exports the Pdf file and sends it to the client side. I would like to store my file on server side. I'm using ASP.NET with Visual Basic.

Thank you in advance for any help.

Best regards,
Lajos Árpád.

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 12 Aug 2012, 04:47 PM
0
Lajos
Top achievements
Rank 1
answered on 12 Aug 2012, 05:32 PM
Thank you for your answer, now the server-side pdf export works, I've defined the following event for that:

    Protected Sub RadGrid1_GridExporting(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridExportingArgs) Handles RadGrid1.GridExporting
        If (CStr(Request("__EVENTTARGET")).Equals("SendEmail")) Then
            Using fs As FileStream = File.Create(_FileName)
                Dim output As Byte() = Encoding.GetEncoding(1252).GetBytes(e.ExportOutput)
                fs.Write(output, 0, output.Length)
                AddStartupScript("openEmailWindow('" & _FileName & "');")
            End Using
        End If
    End Sub

Here _FileName is a generated string, openEmailWindow opens a RadWindow and AddStartupScript registers a startup script. My problem is that my RadWindow doesn't open. There is no problem with openEmailWindow or AddStartupScript as far as I can tell, since they work without a problem if I call them elsewhere. The problem is that after exporting they don't open. How can I enhance the server-side pdf generation with RadWindow opening after the successful export?

Thank you,
Lajos Árpád.
Tags
Grid
Asked by
Lajos
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Lajos
Top achievements
Rank 1
Share this question
or