Export (0) Print
Expand All

Controller.TryValidateModel Method

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.

  Name Description
Protected method TryValidateModel(Object) Validates the specified model instance.
Protected method TryValidateModel(Object, String) Validates the specified model instance using an HTML prefix.

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 TryValidateModel() is like the ValidateModel() method except that the TryValidateModel() method does not throw an InvalidOperationExceptionexception if the model validation fails.

© 2015 Microsoft