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

Pdf export BUG

2 Answers 10 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 1
Pierre asked on 03 Nov 2016, 10:21 AM

Hi,

I have encounter a new bug with my export pdf.
It was working in 2016 R2 SP1. I was in 2016 R3 when we discovert it first and upgrading to SP1 and SP2 didn't fix it.

So i have a function in code behind that process a predefined telerik report and send it via 'Response'.

protected void ExportButton(object sender, EventArgs e)
 {
    // [...] HiddenCode [...]
 
    ReportProcessor reportProcessor = new ReportProcessor();
    Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
    instanceReportSource.ReportDocument = rpt;
    RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, null);
    string fileName = doc + "." + result.Extension;
    Response.Clear();
    Response.ContentType = result.MimeType;
    Response.Cache.SetCacheability(HttpCacheability.Private);
    Response.Expires = -1;
    Response.Buffer = true;
    Response.AddHeader("Content-Disposition"
                            , string.Format("{0};FileName=\"{1}\""
                                            , "attachment"
                                            , fileName)     );
    Response.BinaryWrite(result.DocumentBytes);
    Response.End();
}

 

If i have a RadButton outside of the grid calling this it works. When the button is in the CommandItemTemplate I get Nothing.
Or i get just some server lag.. sometimes a js unnamed error. and that on every Browser.

2 Answers, 1 is accepted

Sort by
0
Pierre
Top achievements
Rank 1
answered on 14 Nov 2016, 03:24 PM
A simple we can not reproduce your issue would have been great.
Instead of just ignoring it.

0
Stef
Telerik team
answered on 14 Nov 2016, 04:48 PM
Hi Pierre,

I guess this is an AJAX issue. The documents bytes should be returned via postback. Callbacks will not let you download the attachment at the client without refreshing the whole page.
Instead you can try returning an anchor tag - link, to the file in the server.

If it is an emergency, please use the support ticketing system. Replies by Telerik representatives in forums, in a timely manner are not guaranteed.
Thank you for your understanding.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Pierre
Top achievements
Rank 1
Answers by
Pierre
Top achievements
Rank 1
Stef
Telerik team
Share this question
or