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

RadAjaxLoadingPanel remains visible after file downloaded to browser

4 Answers 174 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
jlj30
Top achievements
Rank 2
jlj30 asked on 12 Dec 2012, 04:57 PM
Hi,

I have a master page with a RadAjaxPanel wrapped around the ContentPlaceHolder.
This works well for most of my pages with the RadAjaxLoadingPanel popping up as expected and disappearing when the request completes.

My issue occurs when I download a file to the browser using the following sequence of code: (*** Code updated 13dec2012 ***)

Response.TransmitFile(path + Session["Attachment"].ToString());
Response.AddHeader("Content-Disposition", "attachment; filename=" + Session["Attachment"].ToString().Replace(" ", "_"));
Response.ContentType = "application/octet-stream";

The above code is actually in a separate page from the one on which the initial request was launched.  I do a Response.Redirect to get to this second page (which is not displayed, but just performs the above code in its Page_Load event).

The document is successfully downloaded to the browser, but the RadAjaxLoadingPanel remains visible.
Is there something I should be doing to make the loading panel aware that the request is complete?
I have tried using Response.End() but this causes an error.

Once again, the loading panel is working fine for any other type of requests; it's only the document download that causes the problem.

Any suggestions would be greatly appreciated.

Thanks in advance.

Jim

4 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 17 Dec 2012, 02:18 PM
Hi Jim,

The downloading scenario described is not supported by the MS Ajax framework. Please review the following help articles which describe how to download files and redirect to another page with RadAjax:

 

All the best,
Angel Petrov
the Telerik team
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 their blog feed now.
0
jlj30
Top achievements
Rank 2
answered on 18 Dec 2012, 08:41 PM
Angel,

Thanks for your suggestions.
The RadAjaxPanel1.ResponseScripts.Add(...) solution (identified in your first link) worked for me.
I call this when I have completed building the document to be downloaded.
This causes the loading panel to disappear and the browser notifies me that I have a file to save/open just a second or two later.
The redirected page (in my case ViewAttachments) performs the actual TransmitFile.

MstrPanel1.ResponseScripts.Add(String.Format(@"window.location.href = ""{0}"";", "ViewAttachments.aspx?Path=ExternalDocs&Delete=No"));

Thanks again.

Jim
0
Kishan
Top achievements
Rank 1
answered on 05 Jun 2015, 06:00 AM

Hi,

I have a one imagebutton inside telerik radgrid control when i click on image getting the image path and download the file.

I use the same above code in my page. But file not downloaded. 

 RadAjaxPanel1.ResponseScripts.Add(String.Format(@"window.location.href = ""{0}"";", "http://localhost:89/images/Logs/test.tif"));

event occurs successfully but file not downloaded?

 is there any ajax effect to restrict the download in telerik:RadAjaxpanel?

Please give the proper and quick solution for this its very urgent for me to download functionality.

I already searching too much but not getting solution.

 Thanks & Regards

 Kishan Prajapati

 

 

 

0
Angel Petrov
Telerik team
answered on 09 Jun 2015, 01:49 PM
Hi Kishan,

In attachments you can find a sample web site which illustrates a possible realization of the targeted scenario. Hope the provided sample helps you achieve the desired goal.

Regards,
Angel Petrov
Telerik
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
Ajax
Asked by
jlj30
Top achievements
Rank 2
Answers by
Angel Petrov
Telerik team
jlj30
Top achievements
Rank 2
Kishan
Top achievements
Rank 1
Share this question
or