ASP.NET MVC 是否提供任何方法来实现 UpdateProgress WebForms 控件模拟?
ASP.NET MVC 是否提供任何方法来实现 UpdateProgress WebForms 控件模拟? 谁能解释一下如何使用 MVC 实现此类客户端功能?
Does ASP.NET MVC provide any way to implement UpdateProgress WebForms control analog? Can anyone explain me how to achieve such client-side functionality with MVC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用一点 jQuery 和 AJAX 可以很容易(或者复杂,如果你想做一些困难的事情)来做到这一点。 这个小片段通过将部分视图呈现为 HTML 的方法更新了 DIV。 它首先用加载消息替换当前内容,然后在返回数据时覆盖加载消息,用服务器的响应更新 DIV。 您可以执行其他操作,例如显示动画 GIF,或者变得非常复杂并设置间隔计时器来定期检查长时间运行的活动的状态并执行进度表。 显然,后者要复杂得多。
Using a little jQuery and AJAX makes it pretty easy (or complex, if you want to do something hard) to do this. This little snippet updates a DIV from a method that renders a partial view to HTML. It first replaces the current contents with a loading message, then updates the DIV with the response from the server by overwriting the loading message when the data is returned. You can do other things like showing an animated GIF or get really complex and set up an interval timer to periodically check the status of a long running activity and do a progress meter. Obviously, the latter is much more complex.