Click here to Skip to main content
15,868,065 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi i am new in asp.net

i want to download pdf file saved in folder from grid view (showing file name , path etc) , giving button or hyperlink

i tried some code but its not working , somebody pls help me

thanks in advance
Posted
Updated 21-May-15 0:21am
v3
Comments
Mathi Mani 20-May-15 15:44pm    
Where are you getting the error? What is the error you are getting? Provide some more details.
Member 8893861 21-May-15 14:25pm    
done thank u

1 solution

Hi, Add link button with button click event and use TransmitFile method of Response object to download. https://msdn.microsoft.com/en-us/library/12s31dhy(v=vs.110).aspx[^]

Or,
you can add a hyperlink with href populated by Eval

<a href="<%#Eval("link") %>"><asp:label id="lblDealId" runat="server" text="<%#Eval("link") %>" xmlns:asp="#unknown"></asp:label> </a>
 
Share this answer
 
Comments
Member 8893861 21-May-15 8:24am    
I am trying the same
but how to find row cell value of that row ?


protected void CustomersGridView_SelectedIndexChanged(object sender, EventArgs e)
{


Response.ContentType = "Application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=filename.pdf");
Response.TransmitFile(Server.MapPath("~/.pdf"));
Response.End();
}

protected void GridView4_RowCommand(object sender, GridViewCommandEventArgs e)
{
int RowIndex = GridView4.....
}
siddartha kopparapu 21-May-15 9:03am    
int index = Convert.ToInt32(e.CommandArgument);
use this to get index of the row
Member 8893861 21-May-15 14:24pm    
done
thank u siddartha

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