Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ValidateModel Method

Controller.ValidateModel Method

 

Validates the specified model instance.

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

NameDescription
System_CAPS_protmethodValidateModel(Object)

Validates the specified model instance.

System_CAPS_protmethodValidateModel(Object, String)

Validates the specified model instance using an HTML prefix.

Return to top

Controller.ValidateModel Method (Object)

Validates the specified model instance.

protected internal void ValidateModel(
	object model
)

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.

Return to top

Controller.ValidateModel Method (Object, String)

Validates the specified model instance using an HTML prefix.

protected internal void ValidateModel(
	object model,
	string 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.

Return to top
Show:
© 2015 Microsoft