Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
code for download files in datalist when clicked on a image button
Posted
Comments
BiteForce 18-Jul-13 5:59am    
more concrete pls, it´s not even a question.
katangurianusha 18-Jul-13 6:29am    
what is the code for downloading files(i.e,like zip,rar,jpeg etc) when clicked on a button in datalist
[no name] 18-Jul-13 6:04am    
effort for download files in datalist when clicked on a image button
katangurianusha 18-Jul-13 6:29am    
what is the code for downloading files(i.e,like zip,rar,jpeg etc) when clicked on a button in datalist
[no name] 18-Jul-13 7:29am    
If you are unwilling or incapable of writing this code for yourself you need to go hire someone to write it for you. If you have a specific problem with the code that you have written, then you need to show us your effort and explain your problem.

bind the file path in CommandArguments and write the download code in imagebutton command event

C#
<asp:imagebutton id="btn" runat="server" commandarguments="<%#Bind("FilePaht")%>" oncommand="btn_Command" xmlns:asp="#unknown"></asp:imagebutton>

protected void btn_Command(object sender,CommandEventArgs e)
{
   Response.WriteFile(MapPath(e.CommandArguments.ToString()));
   Response.End();
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900