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

Close RadWindow upon PDF Output from Response Object

1 Answer 77 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 16 May 2011, 07:25 PM
I have a little scenario I am having trouble with.  Basically, I have a webform which users can click a button and get a PDF output report.  Upon clicking the button, I show a radWindow with a animated gif stating "please wait, while the report is created."  On the server side, I am responding to the request with a PDF document in the response.binarywrite method.  Therefore, the user will get a prompt to open/save/cancel the downloaded pdf document. 

My problem is that the original webpage doesn't refresh and doesnt close the radwindow.  It seems that outputting the PDF via the response object doesnt refresht the parent page calling the postback. Oh, by the way this is not AJAX.  I am using a standard post-back.

Dim

 

 

rpt As New NewHireReport

 

 

 

Dim rptProc As New Telerik.Reporting.Processing.ReportProcessor

 

 

 

Dim rendRst As RenderingResult = rptProc.RenderReport("PDF", rpt, Nothing)

 

 

 

Dim filename As String = rendRst.DocumentName & ".pdf"

 

 

 

 

 

 

 

Response.Clear()

 

Response.ClearHeaders()

 

Response.ContentType = rendRst.MimeType

 

Response.Expires = -1

 

Response.Buffer =

 

True

 

 

 

 

 

 

 

Response.AddHeader(

 

"Content-Disposition", String.Format("{0};FileName=""{1}""", "attachment", filename))

 

 

Response.BinaryWrite(rendRst.DocumentBytes)


Is there a way to close the radwindow?

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 18 May 2011, 11:54 AM

Hello Dan,

I am not sure how exactly you open the RadWindow and how you expect to close it, but what I can suggest is that from the code-behind method that outputs the stream you also inject a JavaScript function that will close the RadWindow. I believe the following blog post may help you in that task: http://blogs.telerik.com/supportdept/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx. As for the necessary function - you basically need to get a reference to the window (by the $find() method, for example) and call its close() method.

If a postback actually occurs you can try setting the VisibleOnPageLoad proeprty of the RadWindow to false in the code-behind.

If the above suggestions do not help you resolve the situation please open a support ticket and send us a sample, fully runnable project that isolates this issue so that we can examine it locally and provide a more to the point answer.



Kind regards,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Window
Asked by
Dan
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or