Hi,
I have a web page with a WARP control, which contains a button and a few labels. I would like to click on the button inside the WARP, which results in a form being generated and then allows the user to download the form via Response.TransmitFile.
What I find at the moment is the form is generated ok(ie checked my code is working ok there), but when the code for the response.transmitfile is executed nothing happens. I would appreciate any help on this! Cheers David
The code snippet here is:
Response.AppendHeader("Content-Disposition", "attachement; filename=" + zipFileName.ToString());
Response.ContentType = "application/zip";
Response.TransmitFile(transmitFile);
Response.Flush();
Response.Close();
Response.End();
I'm glad that helped.
The reason your page doesn't flicker is because of what you're sending in the response. Since it's not an HTML document, the browser doesn't replace the current contents of the page.
Depending on the file types you send down, the browser you're using, and settings that affect that browser, this might not always be the case. For instance, if you send down an image, your browser might navigate to that image as if you'd clicked on a link.
Thanks Vince. I did this and and also moved the button to be outside the WARP and file can now be downloaded. An interesting observation is that even though the button is in the TriggerPostBackID list the impression I get is of a callback happening. That is to say I click on the button, and then file download dialog box appears, with no flicker of my web page.
Thanks for your quick response
David
WARP expects its response to be in a specific format. When you take over the Response object in this fashion, you destroy the response that WARP was creating on the server. When the response is read by the WARP on the client, it doesn't know what to do with it, and so discards the response entirely.
You will likely need to do this during a full-page postback. My advice is to add your button's ClientID to the TriggerPostBackIDs property of WARP.