Controller.ValidateModel Method (Object)

Validates the specified model instance.

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

function ValidateModel(
	model : Object
)

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

Show: