Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ValidationException Constructor (String, ValidationAttribute, Object)

Initializes a new instance of the ValidationException class using a specified error message, a validation attribute, and the value of the current exception.

Namespace:  System.ComponentModel.DataAnnotations
Assemblies:   System.ComponentModel.Annotations (in System.ComponentModel.Annotations.dll)
  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public ValidationException(
	string errorMessage,
	ValidationAttribute validatingAttribute,
	Object value


Type: System.String

The message that states the error.

Type: System.ComponentModel.DataAnnotations.ValidationAttribute

The attribute that caused the current exception.

Type: System.Object

The value of the object that caused the attribute to trigger validation error.

For more information, see How to: Customize Data Field Validation in the Data Model.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5 SP1

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library
© 2015 Microsoft