简体   繁体   English

来自控制器的 asp.net mvc 刷新视图

[英]asp.net mvc refresh view from Controller

I have the Index page where there is an Html.ActionLink.我有索引页面,其中有一个 Html.ActionLink。 This link is calling a function in the controller and creating a csv file into the local user drive.此链接正在调用控制器中的函数并将 csv 文件创建到本地用户驱动器中。 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!非常感谢! :) :)

You can use return RedirectToAction("Index");您可以使用return RedirectToAction("Index"); for reloading Index page.用于重新加载索引页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM