Export (0) Print
Expand All

Controller.ValidateModel Method

.NET Framework 4

Validates the specified model instance.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

  NameDescription
Protected method ValidateModel(Object) Validates the specified model instance.
Protected method ValidateModel(Object, String) Validates the specified model instance using an HTML prefix.
Top

When a model is being validated, all validators for all properties are run if at least one form input is bound to a model property.

The ValidateModel is like the method TryValidateModel except that the TryValidateModel method does not throw an InvalidOperationException exception if the model validation fails.

For more information model validation, see the entry Input Validation vs. Model Validation in ASP.NET MVC on Brad Wilson's blog.

Community Additions

ADD
Show:
© 2014 Microsoft