Click here to Skip to main content
15,997,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used open/save dialog box inside update panel in asp.net but it is not working because of the code line:
Response.WriteFile(path);

Can I use any thing else for opening a file through open/save dialog box.
My code for opening the file:
C#
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.AppendHeader("content-disposition","attachment; filename=" + name);
Response.ContentType = "Application/msword";
Response.WriteFile(path);
Response.Flush();
Response.Close();
Response.End();
Posted
Updated 1-Jun-11 23:58pm
v3
Comments
Member 7804851 25-Jan-12 9:13am    
I've got the same problem. Works fine if i move the button into the body. Does anyone have a solution for this. I'm sure it has something to do with the partial rendering...

Add this to your page_Load() Event

ScriptManager.GetCurrent(this).RegisterPostBackControl("Your Control id(want to open file dialogue when click)");
 
Share this answer
 
You need the button to cause a full postback rather than a partial. i.e.
XML
<Triggers>
    <asp:PostBackTrigger ControlID="btnFileUpload"/>
</Triggers>
 
Share this answer
 
Are you trying to save a file to the client, or to the server? Response.WriteFile isn't what you want to use. Try Response.TransmitFile, and I'm not sure your really need/want to call Flush, Close, or End.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900