0

I have the Index page where there is an Html.ActionLink. This link is calling a function in the controller and creating a csv file into the local user drive. at the end of the function, i am trying to refresh the page, after the file was downloaded. I tried "return View()" And redirect, both doesn't work since i'm already on the index page and i want to stay there. Any ideas? Html:

<div class="col-6 text-right">
    <p>@Html.ActionLink("Export Unshipped To CSV", "ExportToCSV")</p>
</div>

Thank you very much! :)

Kobi
  • 117
  • 2
  • 12
  • 1
    I don't think there's a way to know when the file has been downloaded so there's no event that you can hook into. You could just use JS to reload the page after X seconds - [as shown in this SO post](https://stackoverflow.com/a/27835326/2008963) – Lee Booker Oct 16 '20 at 14:07
  • How can i activate the JS Function after the link was pressed? – Kobi Oct 16 '20 at 14:11
  • 1
    You need to add a binding on your div element. Look at the fiddler link on the post I linked you to :) – Lee Booker Oct 16 '20 at 14:13

1 Answers1

0

You can use return RedirectToAction("Index"); for reloading Index page.

  • Hi, No, This doesn't work since i'm already at Index view, it won't refresh. – Kobi Oct 16 '20 at 14:15
  • @Kobi Could you please attach a sample Github repository or put all of your codes according to this problem here which shows this issue? Actually, this should works fine. – FatemehFattahi Oct 16 '20 at 14:25