c# - Download feature not working within update panel in asp.net -


I have a web user control that contains FormView . Form view shows job seeker details I have provided a button for the "download resume" link, so that administrator can download / restart the HR. I have placed this control in the ASPX page which contains the update panel. Everything works fine except for the download link

I have given a command on the donwload link button and a function is associated with the order to start the download.

Below I've implemented the code -

  // Click on the command form, under 'Download', the formview protected void lnkDownload_Command (Object Sender, CommandEventArgs e) { If (e .CommandName.Equals ("Downloads")) {StartDownload (e.CommandArgument.ToString ()); }} // Routine to download my dialline // sFileInfo file path $ $ = MIME type protected void start download (string sFileInfo) {string [] d = sFileInfo.ToString (). Split ((new string [] {"$ == $"}), string split option. Non;); String filename = D [0]; String docType = d [1]; System.IO.FileInfo file = new system.IO.FileInfo (d [0]); If (file.Exists) {Response.Clear (); Response.AddHeader ("Content-Displacement", "Attachment; File Name =" + D [0]); Response.AddHeader ("content-length", file. Length.tostring ()); Response.ContentType = d [1]; Response.WriteFile (file.FullName); Response.End (); } Other {server} Transfer ("~ / Mesgbox.aspx? Cat = 2"); }}   

If the update panel has been removed, the code works perfectly but the script generates errors if the update panel is used.

Any suggestions ....?

Thank you for sharing your time. To start a full page postback, you add a postback trigger to your updates panel:

/ P>

  & lt; Asp: UpdatePanel runat = "server" & gt; & Lt; Trigger & gt; & Lt; Asp: PostBackTrigger ControlID = "YourControlID" /> & Lt; / Trigger & gt; & Lt; ContentTemplate & gt; .....    

Comments