Controller::TryValidateModel Method
Validates the specified model instance.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
| Name | Description | |
|---|---|---|
![]() | TryValidateModel(Object^) | Validates the specified model instance. |
![]() | 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.
Controller::TryValidateModel Method (Object^)
Validates the specified model instance.
Parameters
- model
-
Type:
System::Object^
The model to validate.
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.
Controller::TryValidateModel Method (Object^, String^)
Validates the specified model instance using an HTML prefix.
Parameters
- model
-
Type:
System::Object^
The model to validate.
- prefix
-
Type:
System::String^
The prefix to use when looking up values in the model provider.
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.
