Results 1 to 3 of 3

Thread: Download Excel file link

  1. #1
    Join Date
    Apr 2014
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default Download Excel file link

    Hi,

    I have code that works to create an Excel file of data presented on my .asp page.

    The code automatically downloads the file when I access the page. How do it get it to work only when a link is clicked.

    The code I am using is


    Code:
    <%
    Response.ContentType = "application/vnd.ms-excel"
    Response.AddHeader "Content-Disposition", "filename=excelfile.xls"
    %>
    Thanks

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,035
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    I'm not an ASP user but I would imagine you can write the file download code into a function and call it onclick.

    Try http://stackoverflow.com/questions/1...n-as-hyperlink

    Or how about creating a link that points to a file (e.g. 'download.asp'), and then put only your file download code into that file.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. The Following User Says Thank You to Beverleyh For This Useful Post:

    padders01 (11-27-2015)

  4. #3
    Join Date
    Apr 2014
    Posts
    19
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Great, that's given me an idea and I have it working now

    Thank you

Similar Threads

  1. Resolved Excel-file on a web-page using php?
    By Gert in forum Looking for such a script or service
    Replies: 3
    Last Post: 03-10-2009, 06:24 AM
  2. Popup File download window that closes when download button clicked
    By amccann in forum Looking for such a script or service
    Replies: 5
    Last Post: 10-27-2007, 01:37 PM
  3. Replies: 7
    Last Post: 09-12-2007, 06:01 PM
  4. Download MySQL Data To Excel
    By tomyknoker in forum PHP
    Replies: 1
    Last Post: 04-11-2007, 01:37 PM
  5. about export to Excel file
    By ceciliacom in forum HTML
    Replies: 0
    Last Post: 02-17-2006, 05:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •