Download file Stuck in SharePoint Visual WebPart

I have a download link control inside a SharePoint Visual WebPart to download an attached file in PDF formatm but when I clicked on the link the save dialog is shown properly then  when I clicked on Save or Open button, I had noticed that The page is hanging and I can’t make any action!

Download file Stuck in SharePoint Visual WebPart


To solve this issue, you should let the web form return true on submit event as the following:

  • In front code of User Control add the following JavaScript code.
function myFunction()
{window.WebForm_OnSubmit = function() {return true;};}
  • Add OnclientClick event to the link control and assign the previous defined function.
OnClientClick = "myFunction()"
  • Or you can also put it in Back-End code as the following.
protected void Page_Load(object sender, EventArgs e)
{ Link1.OnClientClick = "myFunction()"; // or any other event }

Applies To

  • SharePoint 2013.
  • SharePoint 2010.

Leave a Reply

Scroll to Top