Solved

How can I popup a save dialog in asp.net

Posted on 2004-08-10
3
400 Views
Last Modified: 2007-12-19
How can I popup a save dialog in asp.net to save a some text and in the same page I want to provide a option to print the same content

Thanks in advance for your help
0
Comment
Question by:sasikumar06
3 Comments
 
LVL 3

Accepted Solution

by:
nhewitt21 earned 20 total points
ID: 11772363
Heres some code to do a popup save as dialog:
Response.ContentType = "application/octet-stream";
Response.AddHeader("content-disposition", "attachment; filename=" + myFileName);        // myFileName is the variable that holds the name of your text file etc

FileStream sourceFile = new FileStream(myFileName, FileMode.Open);
long FileSize;
FileSize = sourceFile.Length;
byte[] getContent = new byte[(int)FileSize];
sourceFile.Read(getContent, 0, (int)sourceFile.Length);
sourceFile.Close();

Response.BinaryWrite(getContent);

and here is a link to info regarding Reading/Writing data to text files: http://www.automatedqa.com/techpapers/textfiles_net.asp

Hope this helps you out, thanx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question