Dave Burke : Freelance .NET Web Developer specializing in Online Communities

Two File Save-Open Dialogs on Excel Output solution

I recently posted about outputting to native Excel and how easy it was to do efficiently with .NET.  I also mentioned the annoyance of the two file save-open dialog boxes which displayed when the file was being output.

Big thanks to Mark Struck for his thoughts and referral to a KB article, which, while it didn't provide the solution, did point me in the right direction.  The KB mentions the data type not being known in the URL Get Request and IE not knowing what type of file to expect in the server Response, thus defaulting to a Octet-Stream data type.

In working on the fix I did a Response.Flush and .Writefile and found prompts for the parent page's header info, specifically, for the location of the page's stylesheets.  It was then I realized the solution:  I needed to send a fresh header to the browser.  Instead of launching the output from a UserControl I redirected to another .ASPX which has the sole function of spitting out the data file.  I copied the usercontrol content to the .aspx, essentially, and instead of launching with a Linkbutton am using a simple href hyperlink to the .aspx.

One output file loading in native Excel, one file save-open dialog box.  Just as God intended.

[OT] If anyone's interested in skiing pics from my yesterday morning spring skiing at Smuggler's Notch, they're located here.  It was a beautiful day in Vermont!  I don't put non-.NET posts my Off Topic in the ASPNET Main Feed, but wanted to mention the pics since it was such a beautiful day...

 

Comments (0) | Post RSS RSS comment feed

Posted on 4/8/2004 6:52:00 AM by Dave Burke
Categories:
Tags:

Related posts


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke