Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TransmitFile and Update Panel

Status
Not open for further replies.

TheVillageIdiot27

Programmer
Nov 10, 2005
58
GB
Hi

I have an update panel which has an async trigger which is a button which sits outside of the panel and during the VB event handler for the button a file is created on the web server.

What I am trying to achieve is the "open /save" box that I get with my standard getfile.ashx?filename=blah.pdf, but at the point when the update panel has been refreshed, however at this stage I really can't see any kind of solution.

Any ideas gratefully received...


 
not sure if you can do this. you are, in affect, changing the entire stream from html to a byte array. you would need to change the content headers to signal the browser that the content is now a pdf (not html).

that said i would take 2 approaches.
1. drop ajax altogether and to a full request to the server.
2. keep the ajax, but only return the filename once the file is created. then redirect the browser to the file (or file handler) for download.

Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Thanks Jason

I agree with what you are saying however if at all possible I would like to keep the ajax in place - can you see anyway of firing some javascript after an update panel has updated?

The action that is taking place while the update panel is updating is the execution and exporting of a crystal report - an update panel with an update progress control seems like a good solution for this given that this process may take more than a few seconds.


 
the update panel will not improve preformance. It doesn't even remove the full postback (that still happens. there is an article posted at MSDN WickedCode on the topic). The only benefit you can get with this procedure is giving the user the appearance of better preformance.

if the process takes 45 seconds with a full postback it will take 45 seconds using ajax (possibly even 46-49 seconds because of the full postback in an ajax request overhead).

The client side scripting has quite a few hooks. tying into one of the events that fires after the update would be the place to set document.location = 'path to view file';

I'm not familiar with MS AJAX library. I use jQuery.


Jason Meckley
Programmer
Specialty Bakers, Inc.

faq855-7190
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top