Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ImageButton and download file

Reply
Thread Tools

ImageButton and download file

 
 
adnan.masood@motiont.com
Guest
Posts: n/a
 
      06-19-2008
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>
 
Reply With Quote
 
 
 
 
Munna
Guest
Posts: n/a
 
      06-19-2008
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
 
Reply With Quote
 
 
 
 
Peter Bucher [MVP]
Guest
Posts: n/a
 
      06-19-2008
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
 
Reply With Quote
 
Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
Guest
Posts: n/a
 
      06-19-2008
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


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:ImageButton and onClientClick and page refresh rum23 ASP .Net Web Controls 1 01-24-2009 01:25 PM
Forcing Download of File Appends HTML from Download Page to Downloaded File? Brett Kelly ASP .Net 1 06-16-2006 04:05 AM
problem with code download file - two window file download Sam -- ASP .Net 2 03-17-2005 04:20 PM
File upload/download from database. Download appends aspx page to end of file Ryan Taylor ASP .Net 2 11-10-2004 08:31 PM



Advertisments