开发者

File download with Jquery Mobile and ASP.NET MVC 3 Razor

开发者 https://www.devze.com 2023-03-05 19:50 出处:网络
I have a page in my website that requires a simple file download link. This link is implemented via the combination of an action link and a File ActionResult like so:

I have a page in my website that requires a simple file download link. This link is implemented via the combination of an action link and a File ActionResult like so:

View Code:

@Html.ActionLink("Download", "Download", new { id = 1 }, new { @data_role = "button" }) 

Controller Code:

public ActionResult Download(int? id)
{
  ..
  ..
  return File(fileStream, fileInfo.Extension, fileInfo.Name);
}

This works fine without Jquery Mobile applied, but when I swit开发者_StackOverflow中文版ch on Jquery mobile the page freezes up after the action method returns from my controller.

Do I need to do something special with Jquery mobile for this to work correctly?


I think you might need to turn off the ajax loading for that link. There are a couple of ways to do it, adding rel="external" being one of them.

0

精彩评论

暂无评论...
验证码 换一张
取 消