save as dialog box  
Author Message

PostPosted: Visual C# General, save as dialog box Top

Hello. I am making a web application and am using this code:

Response.ContentType = "application/x-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(" ") + ".csv");
Encoding encoding = Encoding.GetEncoding("Shift-JIS");

It works fine..the data gets saved nicely to an excel file. The user pushes the button to download the file and then a dialog box pops up that asks if they want to save or cancel. If the user presses the save, another dialog box pops up where the user can change the name of the file and choose where to save the file. The problem is that I have been told not to have two dialog boxes pop up. When the user pushes the download button, how do I make only the second dialog box come out I tried

Response.Write("<script type='text/javascript'>document.execCommand('SaveAs',null,' .csv');</script>");

but the webpage just gets saved to excel (not the csv file). I was told maybe I can write some code to click the save so that only the second dialog comes out but I haven't figured it out. Please help me.

Visual C#20  
Mark Dawson

PostPosted: Visual C# General, save as dialog box Top


you would be better of asking this in an ASP.Net forum: