Working with buttons


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Working with buttons

  1. #1
    Join Date
    Mar 2005
    Posts
    105

    Working with buttons

    I have a newbie question ...

    I have a button on a website that needs to trigger a download when it's clicked. If I know the location of the file to be downloaded, how can I make that happen in the HTLM code.

    Thanks!

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Since this is the ASP.NET forum, I assume you're looking for server-side ASP.NET code? You can put code like the following in the button's server-side Click event procedure:
    Code:
    Response.ContentType = "application\octet-stream"
    Dim FileName As String = "d:\path\filename.ext"
    Dim fs As New IO.FileStream(FileName, IO.FileMode.Open)
    Response.Write(fs.Length.ToString() & "#")
    fs.Close()
    Response.WriteFile(FileName)
    Response.Flush()
    Response.End()
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

Similar Threads

  1. buttons with templates and formview???
    By dave.potter@hol in forum .NET
    Replies: 2
    Last Post: 01-30-2006, 12:54 PM
  2. Formview - Templates - Buttons ???
    By dave.potter@hol in forum ASP.NET
    Replies: 0
    Last Post: 10-07-2005, 07:10 PM
  3. Dynamic Buttons disappearing
    By spudmasher in forum ASP.NET
    Replies: 3
    Last Post: 07-04-2005, 12:59 AM
  4. Working with Buttons
    By ej in forum Java
    Replies: 1
    Last Post: 11-02-2002, 08:58 AM
  5. Java Newbie: Working with GUI Windows
    By Scott in forum Java
    Replies: 0
    Last Post: 11-30-2000, 11:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center