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. how to downoad attachment file

how to downoad attachment file

Scheduled Pinned Locked Moved ASP.NET
helptutorialquestion
3 Posts 3 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.
  • A Offline
    A Offline
    ashu_dhiman
    wrote on last edited by
    #1

    i need help for hows to download attachment file from gridview???

    M J 2 Replies Last reply
    0
    • A ashu_dhiman

      i need help for hows to download attachment file from gridview???

      M Offline
      M Offline
      manognya kota
      wrote on last edited by
      #2

      Hi, Please use the below code

      <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
      onrowcommand="GridView1_RowCommand">
      <Columns>
      asp:TemplateField
      <ItemTemplate>
      <asp:LinkButton ID="LinkButton1" runat="server"
      CommandArgument='<%# Eval("url") %>' CommandName="cmd"><strong class="highlight">Download</strong></asp:LinkButton>
      </ItemTemplate>
      </asp:TemplateField>
      </Columns>
      </asp:GridView>

      For handling this on code behind, see the link below: http://www.daniweb.com/web-development/aspnet/threads/282306[^]

      -Manognya __________________________________________________ $ God gives what is best.Not what all you wish :)

      1 Reply Last reply
      0
      • A ashu_dhiman

        i need help for hows to download attachment file from gridview???

        J Offline
        J Offline
        jkirkerx
        wrote on last edited by
        #3

        It depends on your program design first. You can issue a postback to the server, and reload the page, while sending the file down to the browser, if the user clicks ok on the download, or you can do it on the client side using javascript, in which the page stays intact, and javascript intializes the download. I use the javascript method now. I see no reason to issue a postback, even if it's async. Javascript window.open(url to file);

        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