Async page load in mvc

风格不统一 提交于 2019-12-13 04:42:29

问题


Im mvc application,there is a some view, data of some portion in view is taking time at the server end, so I need to load the other part of the view first and when the process completes the remaining portion will load.

For this I have create a partial view the partial view action is async and returns a task. But in Mvc 5 I cant use await keyword in view. I sesrch for that mvc 6 is fix this issue.

So now I am loading the partial view by using ajax call. But can I do without ajax call. Or with c# async programming feature.


回答1:


You have to perform async operations in controller in top level action - neither view nor child actions can be asynchronous in versions up to ASP.Net MVC5.

Or wait till MVC6 is ready, or if you case allows that use MVC6 now - vNext.



来源:https://stackoverflow.com/questions/27031359/async-page-load-in-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!