AJAX UpdatePanel Force .Net Download

AJAX UpdatePanel Force .NET Download

Problem:
 How to eaily allow users to download files from a website using AJAX for the file downloads.

 I wanted to allow a user to click on a in item in a grid or a button to trigger the update panel to ready a file for download without refreshing the web page.

 I attempted to do so with the Update Panel and Response.WriteFile() function with no luck. The Update Panel ignores all of the Headers that are sent back from the AJAX call back except for those that pertain to the controls in the Update Panel.

So then I thought I would be smart and use a .NET Literal Control and update the text property to add a Javascript Window open for the file.
Literal1.Text = "<script type='text/javascript'>var MyPrintWindow = window.open('" + sFileURL + "','mywindow','menubar=1,resizable=1,width=450,height=250');</script>";
 But that had little luck as well. I am a little curious why this dosen't work. I used the exact same type of idea with the Infragistics WebAsyncRefreshPanel and for someone else and it works flawlessly.

 

But thats microsoft for you. So at this point to save time I came up with the following solutions.

Solution:

Use the update panel to trigger server side copy process of the thile

posted @ Sunday, August 19, 2007 1:05 PM

Print

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
 
Please add 2 and 4 and type the answer here:
 

Live Comment Preview:

 
«July»
SunMonTueWedThuFriSat
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567