Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. SaveFileDialog in ASP.NET

SaveFileDialog in ASP.NET

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BECK7
    wrote on last edited by
    #1

    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?

    S C 2 Replies Last reply
    0
    • B BECK7

      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?

      S Offline
      S Offline
      SABhatti
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • S SABhatti

        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

        B Offline
        B Offline
        BECK7
        wrote on last edited by
        #3

        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..

        S 1 Reply Last reply
        0
        • B BECK7

          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..

          S Offline
          S Offline
          SABhatti
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • B BECK7

            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?

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #5

            Where does the file come from ? Where do you hope to save it ? ( i.e. client or server ) Christian Graus - Microsoft MVP - C++

            B 1 Reply Last reply
            0
            • C Christian Graus

              Where does the file come from ? Where do you hope to save it ? ( i.e. client or server ) Christian Graus - Microsoft MVP - C++

              B Offline
              B Offline
              BECK7
              wrote on last edited by
              #6

              the file is in the server, and the user will download it to his machine.... thanks...

              C 1 Reply Last reply
              0
              • B BECK7

                the file is in the server, and the user will download it to his machine.... thanks...

                C Offline
                C Offline
                Christian Graus
                wrote on last edited by
                #7

                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++

                B 1 Reply Last reply
                0
                • C Christian Graus

                  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++

                  B Offline
                  B Offline
                  blakshmi
                  wrote on last edited by
                  #8

                  Hi, If u found solution for this can u give me!!!! plzzzzz Thank u

                  Lakshmi

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups