How to set file download inside the update panel

Topics: Developer Forum, Project Management Forum, User Forum
Jun 28, 2010 at 8:36 PM
Guys, I am using Excel package I want to know how I can set file for download inside the update panel. I tried this code System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=Audit_Number_Result.xlsx"); System.Web.HttpContext.Current.Response.WriteFile(outputDir.FullName + @"\Audit_Number_Result.xlsx"); System.Web.HttpContext.Current.Response.End(); But still I am getting error any help and idea, is there is any method in Excelpackage that allow file to save at response directly. Thanks
May 12, 2011 at 8:31 PM
Edited May 12, 2011 at 8:32 PM

Please add a PostBackTrigger to your Control which is used to Download.

 

 

</ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="cmdExport" />
        </Triggers>
    </asp:UpdatePanel>