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

前端之家收集整理的这篇文章主要介绍了asp.net-mvc-3 – 什么是MVC 3中的ModelState类?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在学习MVC,而在ASP.Net MVC 3中,什么是 ModelState类?我看过Google和MSDN,但我似乎无法清楚地了解它的目的.谁能帮忙?
@H_301_3@解决方法
看看 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

原文链接:https://www.f2er.com/aspnet/250188.html

猜你在找的asp.Net相关文章