加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-mvc-3 – 什么是MVC 3中的ModelState类?

发布时间:2020-12-15 23:17:50 所属栏目:asp.Net 来源:网络整理
导读:我正在学习MVC,而在ASP.Net MVC 3中,什么是 ModelState类?我看过Google和MSDN,但我似乎无法清楚地了解它的目的.谁能帮忙? 解决方法 看看 http://www.gxclarke.org/2010/05/consumption-of-data-in-mvc2-views.html在ViewData.ModelState部分. The ModelSta
我正在学习MVC,而在ASP.Net MVC 3中,什么是 ModelState类?我看过Google和MSDN,但我似乎无法清楚地了解它的目的.谁能帮忙?

解决方法

看看 http://www.gxclarke.org/2010/05/consumption-of-data-in-mvc2-views.html在ViewData.ModelState部分.

The ModelState property is a dictionary object that tracks HTTP values submitted to the server. In addition to storing the name and value of each field,it also tracks associated validation errors. Although its name may suggest otherwise,ModelState isn’t Model-aware. It doesn’t understand what a “Product” is. It simply contains a collection of items with names such as “ProductName” and “UnitPrice”. It is the responsibility of other objects—ModelBinders,ViewResult,and the strongly-typed View—to map and interpret ModelState values as Model properties

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读