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

我正在学习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

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....