请等待ASP.NET MVC中的页面 [英] Please wait page in ASP.NET MVC

查看:157
本文介绍了请等待ASP.NET MVC中的页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

页面执行许多任务,并且处理时间很长.我们希望在每个任务完成时向用户提供反馈.

A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed.

在ASP.NET网络表单中,我们使用了Response.Flush()

In ASP.NET webforms we used Response.Flush()

您将以什么方式在ASP.NET MVC中进行这种处理?

What way would you a approach this in ASP.NET MVC?

推荐答案

您仍然可以将Response.Write()和Response.Flush()用作要通过网络发送的任何状态.或者,如果您在用户控件中遇到了麻烦,则可以执行以下操作:

You can still use Response.Write() and Response.Flush() for whatever status you want to send down the wire. Or if you have your progress thingy in a user-control, you could do something like:

this.PartialView("Progress").ExecuteResult(this.ControllerContext);
this.Response.Flush();

通过控制器的动作方法进行冗长的操作时从控制器中获取.

from your controller while doing your lengthy operation in the controller's action method.

您可以选择此处的注释中提到的这种方法或客户端方法,只是想指出服务器端仍然可行.

It's up to you to choose this or the client-side approach as mentioned in the comments here, just wanted to point out that server-side is still possible.

这篇关于请等待ASP.NET MVC中的页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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