Save File Dialog


T

tshad

I have a file that I am creating to save my GridView information in a CSV
file to the users computer if they press my Export button.

I am not Downloading or uploading a file just streaming the data
(StreamWriter) to whereever the user wantgs to put this CSV file.

I need to be able to bring up a Save As dialog windows to allow them to tell
me where to create the file.

How would I do this?

I am seeing all kinds of information on the web for using SaveFileDialog,
but it doesn't work in my program.

SaveFileDialog save = new SaveFileDialog();

What do I need to do to get this to work?

Thanks,

Tom
 
Ad

Advertisements

T

tshad

Mark Rae said:
The SaveFileDialog class is part of the System.Windows.Forms namespace:
http://msdn.microsoft.com/en-us/library/system.windows.forms.savefiledialog.aspx -
that's never going to work in an ASP.NET application...



http://tinyurl.com/yb4phgq

But as you say this is showing me how to use SaveFileDialog from a windows
app.

Are you saying there is no way for me to get the information the user needs
(csv) to put on their machine from a web page?

The problem is that this information is pretty useless to the user if they
can't get the information to a file they can open up in Excel to manipulate.

I can copy the information into a hiddenfield and then to the clipboard but
then the user has to open up something like notepad or textpad, paste the
information in and then save it.

I need to automate this to make it easy on the user, which I can do from a
Windows app but need to do it from a web page.

Thanks,

Tom
 
Ad

Advertisements

T

tshad

Mark Rae said:
Er, no it's not... Every page returned by the above Google search is
related to ASP.NET - that's why the first element in the search string is
ASP.NET...


Exporting the contents of a GridView to a .csv file is simple enough -
there are literally dozens (maybe hundreds) of examples available:
http://tinyurl.com/ygxvuh5
Already had the exporting part working fine.

My problem (as you know) was getting it to a share and getting a
SaveFileDialog to work.

I solved the SaveFileDialog by setting up a link to the file and allowing
the browser to handle save or execute.

Thanks,

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top