Controller.ValidateModel Method (Object, String)

Validates the specified model instance using an HTML prefix.

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

'Declaration
Protected Friend Sub ValidateModel ( _
	model As Object, _
	prefix As String _
)
'Usage
Dim model As Object 
Dim prefix As String 

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

Show: