banner ad
ASP.NET Forums/General ASP.NET/ASP.NET AJAX + Ajax Control Toolkit (ACT)/How to download file from in ajax?

How to download file from in ajax?[Answered] RSS

10 replies

Last post Oct 05, 2010 10:00 AM by hafiz awais

Chetan Sarode
Team Lead, Product Development
Approva Systems Pvt Ltd, Pune, India.
  • selva38 selva38

    None

    0 Points

    3 Posts

    Re: How to download file from in ajax?

    Apr 03, 2009 12:49 PM|selva38|LINK

    Hey i gottttttttttttttttt it !!!!! problem is from partial post back(update panel). All u need to full postback to the particular button or any control.. change update panel mode to Conditional and add postbacktrigger for particular control. check the below code. Regards Selva
  • selva38 selva38

    None

    0 Points

    3 Posts

    Re: How to download file from in ajax?

    Apr 03, 2009 12:54 PM|selva38|LINK

    Hey i gottttttttttttttttt it !!!!! problem is from partial post back.All u need full post back to the particular button r any control.. add postbacktrigger for updatepanel. check the below code. protected void DownloadAll_Click(object sender, EventArgs e) { DownloadFile(url); } public void DownloadFile(string url) { string URL = url; System.IO.FileInfo fileInfo = new System.IO.FileInfo(URL); if (fileInfo.Exists) { HttpContext.Current.Response.ContentType = "application/zip"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.IO.Path.GetFileName(fileInfo.Name)); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.WriteFile(fileInfo.FullName); HttpContext.Current.Response.End(); } } Regards selva chennai india
  • selva38 selva38

    None

    0 Points

    3 Posts

    Re: How to download file from in ajax?

    Apr 03, 2009 12:56 PM|selva38|LINK

    sorry my previous message not displayed correctly. Regards selva
  • TATWORTH TATWORTH

    All-Star

    44551 Points

    13496 Posts

    MVP

    Re: How to download file from in ajax?

    Apr 03, 2009 01:23 PM|TATWORTH|LINK

     To get your code to display properly, please:

    1. Click on Edit Profile
    2. Select Site Options
    3. Change content editor to enhanced
    4. Click Save
    5. When you next post in either IE or Firefox, you will have an additional tool-bar. At the top right is a button for a code insertion window.
    Click "Mark as Answer" on the post that helped you.
    This earns you a point and marks your thread as Resolved so we will all know you have been helped.
    FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
  • eddiejaques eddiejaques

    None

    0 Points

    1 Post

    Re: How to download file from in ajax?

    Apr 28, 2010 02:14 PM|eddiejaques|LINK

    Is it possible for someone to explain how does micrsoft does it w/o postback

     

    see it for yourself.

     

    http://ajaxcontroltoolkit.codeplex.com/releases/view/43475

     

    Click on the download button

     

    "Application Ajax Control Toolkit .NET 3.5 - Binary

  • hafiz awais hafiz awais

    Member

    6 Points

    56 Posts

    Re: How to download file from in ajax?

    Oct 05, 2010 10:00 AM|hafiz awais|LINK

    Thnks buddy it worked for me 

    sumitd

  • ‹ Previous Thread|Next Thread ›