如何在MVC4 Razor中刷新(重新加载)页面 [英] How to Refresh(Reload) a page in MVC4 Razor

查看:391
本文介绍了如何在MVC4 Razor中刷新(重新加载)页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行插入或更新后,我需要重新加载列表框以获取更新,我需要重新加载页面或部分页面



如何刷新(重新加载)MVC4 Razor中的页面?

After doing insert or update i need to Reload list box to Get Updates for that i need to Reload the page or part of the page

How to Refresh(Reload) a page in MVC4 Razor?

推荐答案

成功执行代码后可以使用JavaScript

window.location.reload();
You can use JavaScript after successfully your code executed
window.location.reload();


再次使用具有控制器名称的相同动作名称

使用此

RedirectToAction(Create,ControlerName );

而不是

返回View();
Just use again same action name with controler name
Use this
RedirectToAction("Create", "ControlerName");
instead of
return View();


If you want to refresh all page then you can use 







return RedirectToAction("ActonName", "ControlerName");
return View(objectname);





如果你想要按照您在问题中的解释重新加载列表框。喜欢以下链接。



http:// stackoverflow.com/questions/18254749/updating-partialview-mvc-4 [ ^ ]


这篇关于如何在MVC4 Razor中刷新(重新加载)页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆