Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MVC 3内に、結果のビューを返す前にすべての検証エラーを列挙できるメカニズムはありますか?
例えば:
if (!ModelState.IsValid) { //Enumerate validation errors }
ModelStateValuesコレクションをループできます
if (!ModelState.IsValid) { foreach (ModelState modelState in ModelState.Values) { foreach (ModelError error in modelState.Errors) { // error.ErrorMessage contains the error message } } }