Export (0) Print
Expand All

Controller.TryValidateModel Method (Object)

Validates the specified model instance.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

'Declaration
Protected Friend Function TryValidateModel ( _
	model As Object _
) As Boolean
'Usage
Dim model As Object 
Dim returnValue As Boolean 

returnValue = Me.TryValidateModel(model)

Parameters

model
Type: System.Object
The model to validate.

Return Value

Type: System.Boolean
true if the model validation is successful; otherwise, false.

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.

Show:
© 2015 Microsoft