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