SaveFileDialog in ASP.NET
-
HI everyone, i need to display a SaveFileDialog to allow the user save a file in a web page of ASP.NET. How can i do this? is there anyplace i can find some code of this?What u recomend me?
here is the vb code... Dim strPath As String = "c:\my projects\upload\" Dim strFileName As String = "InvoiceTemplate.xls" Response.Clear() Response.ContentType = "application/vnd.ms-Excel" Response.AddHeader("content-disposition", "attachement; filename=" & strFileName) Response.WriteFile(strPath & strFileName) Response.End() it should give the open/save option to the user.. Here[^] is an MSDN article on the subject. Salim Akbar
-
here is the vb code... Dim strPath As String = "c:\my projects\upload\" Dim strFileName As String = "InvoiceTemplate.xls" Response.Clear() Response.ContentType = "application/vnd.ms-Excel" Response.AddHeader("content-disposition", "attachement; filename=" & strFileName) Response.WriteFile(strPath & strFileName) Response.End() it should give the open/save option to the user.. Here[^] is an MSDN article on the subject. Salim Akbar
-
The question is: where should i put this code? do i just put it in my event? like a button click or something? thanks in advance..
Well, this a server side code, so will have to submit the form on click of a button (let's say 'DOWNLOAD FILE') and before submitting the form, just set value to a hidden field (let's say field is 'USER ACTION' and value is 'download'). (you can even submit the form in new window by setting its target to '_blank' on clicking of DOWNLOAD FILE button -- javascript) Now in page_load check the value of this field and act accordingly i.e. if value is 'download' then write the code in my previous post.. Hope this will be helpful... Salim Akbar
-
HI everyone, i need to display a SaveFileDialog to allow the user save a file in a web page of ASP.NET. How can i do this? is there anyplace i can find some code of this?What u recomend me?
Where does the file come from ? Where do you hope to save it ? ( i.e. client or server ) Christian Graus - Microsoft MVP - C++
-
Where does the file come from ? Where do you hope to save it ? ( i.e. client or server ) Christian Graus - Microsoft MVP - C++
-
Then you need to create a page that shows the files via a datagrid or something. You can't use a savefiledialog at all in ASP.NET, that I know of, and the html file dialog won't do anything, it browses the client, as you'd expect. Christian Graus - Microsoft MVP - C++
-
Then you need to create a page that shows the files via a datagrid or something. You can't use a savefiledialog at all in ASP.NET, that I know of, and the html file dialog won't do anything, it browses the client, as you'd expect. Christian Graus - Microsoft MVP - C++