Download the pdf file on the server store in folder


Take link button in update panel.
Apply trigger to Link Button.
Write the Follwing Code in the link button click event.


 System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;  
         response.Clear();  
         response.AddHeader("Content-Disposition", "attachment; filename=" + "ABC.pdf" + ";");  
         response.ContentType = "application/excel";  
         response.TransmitFile("~//Downloadable//ABC.pdf");  
         response.End();  


Note: You can change 'response.ContentType = "application/excel";' for excel document,also change file name that u want to download from server folder(eg.ABC.pdf to ABC.csv).

No comments:

Post a Comment