维护视图状态在Asp.net MVC? [英] Maintaining viewstate in Asp.net mvc?

查看:155
本文介绍了维护视图状态在Asp.net MVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<一个href=\"http://stackoverflow.com/questions/366151/asp-net-mvc-doesnt-work-with-viewstate-and-postback\">ASP.NET MVC不ViewState的回传和工作?

之一使用web表单的主要原因是便于能够保持视图状态。我想建立一个asp.net MVC应用程序等什么选择呢我有维护视图状态?

One of the major reasons for using webforms is the ease of being able to maintain viewstate. I would like to build an asp.net mvc application so what options do I have for maintaining viewstate?

推荐答案

ASP.NET MVC不会在传统意义上的使用视图状态(即存储在所述网页的控制值)。相反,对照的值被贴到一个控制器的方法。一旦控制器方法被调用,你跟这些值做什么取决于你。

ASP.NET MVC does not use ViewState in the traditional sense (that of storing the values of controls in the web page). Rather, the values of the controls are posted to a controller method. Once the controller method has been called, what you do with those values is up to you.

ASP.NET MVC将持续控件的值足够长的时间让你对其进行验证和(如果需要)来来回回去到您的网页进行编辑或更正。如果对照验证,可以将它们持久化到数据库或其他数据存储,在那里他们将提供后续GET请求。

ASP.NET MVC will persist the values of the controls long enough for you to validate them and (if needed) to round-trip them back to your page for editing or correction. If the controls validate, you can persist them to a database or other data store, where they will be available for subsequent GET requests.

这篇关于维护视图状态在Asp.net MVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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