标签:style io color ar os sp for on cti
if (!ModelState.IsValid) { List<string> sb = new List<string>(); //获取所有错误的Key List<string> Keys = ModelState.Keys.ToList(); //获取每一个key对应的ModelStateDictionary foreach (var key in Keys) { var errors = ModelState[key].Errors.ToList(); //将错误描述添加到sb中 foreach (var error in errors) { sb.Add(error.ErrorMessage); } } return Json(sb); }
标签:style io color ar os sp for on cti
原文地址:http://www.cnblogs.com/zhaojianwei/p/4101184.html