savefiledialog for webforms

  • Thread starter Thread starter kollatjorva
  • Start date Start date
K

kollatjorva

hi
I have a web page with displays informations from an xml. On the same
web page is a "save xml as" button and when the button gets fired, I
want to display a save as dialog for the user to save the xml in a file

on his client machine.
Is this possible to do, we have savefiledialog in winform but is there
any similar for webforms?
Any help wil be very mutch appreciated and if you can provide some code

examples I would be very happy woman!
Thanks
 
Nope, you don't have any control over the client. The best you can do
is stream the xml and make sure to set the Content Headers correctly;
depending on the browsers settings, they may or may not get a save as
dialog.

HTH
Andy
 
Hi,

If you can restrict your clients to IE then you can use the following JavaScript from your button's onclick event handler:

document.execCommand("SaveAs", true, null);

SaveAs Command on MSDN:
http://msdn.microsoft.com/library/d...p/author/dhtml/reference/constants/saveas.asp

All Commands on MSDN:
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/commandids.asp

(Note that the document is out of date, somewhat. Some of the commands that say "Not currently supported" actually seem to work.
e.g. Undo and Redo.)
 
Back
Top