ImageButton and download file

Discussion in 'ASP .Net' started by adnan.masood@motiont.com, Jun 19, 2008.

  1. Guest

    I want to put a image button on the page where if user clicks should
    download a zip file for the user

    I could do it following way but I want to put asp.net button.

    <a href="Myzip.zip"><img src="images/download_trial_btn.gif"/></a>
    , Jun 19, 2008
    #1
    1. Advertising

  2. Munna Guest

    Hi

    Hi whats wrong with your current code? it works and work okay...

    well

    here is a code example... for you,,,,

    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/
    cet_normal.png" onclientclick="yahoo(); return false;" />
    <script language="javascript" type="text/javascript">
    function yahoo()
    {
    window.location = "http://localhost:5504/
    icons_for_entity.zip";
    return false;
    }
    </script>

    Best of luck

    Munna
    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
    Munna, Jun 19, 2008
    #2
    1. Advertising

  3. Hello adnan

    > I could do it following way but I want to put asp.net button.

    Why?

    > <a href="Myzip.zip"><img src="images/download_trial_btn.gif"/></a>

    Use a HyperLink Control and thus .ImageUrl Property.

    At this issue, a ImageButton is not needed - its the wrong control instead.

    --
    Gruss, Peter Bucher
    Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
    Peter Bucher [MVP], Jun 19, 2008
    #3
  4. In the image button's server side click event you could put code like this:

    Response.Redirect("Myzip.zip")

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net
    http://iPhonePlaza.net


    <> wrote in message
    news:...
    >I want to put a image button on the page where if user clicks should
    > download a zip file for the user
    >
    > I could do it following way but I want to put asp.net button.
    >
    > <a href="Myzip.zip"><img src="images/download_trial_btn.gif"/></a>
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Jun 19, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Taylor
    Replies:
    2
    Views:
    911
    Ryan Taylor
    Nov 10, 2004
  2. Steve C. Orr [MVP, MCSD]
    Replies:
    0
    Views:
    1,571
    Steve C. Orr [MVP, MCSD]
    Mar 7, 2005
  3. Sam --
    Replies:
    2
    Views:
    583
    Sam --
    Mar 17, 2005
  4. Brett  Kelly
    Replies:
    1
    Views:
    650
    Steve C. Orr [MVP, MCSD]
    Jun 16, 2006
  5. rum23

    asp:ImageButton and onClientClick and page refresh

    rum23, Nov 28, 2008, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    558
Loading...

Share This Page