CompareAttribute Class

Provides an attribute that compares two properties of a model.

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

public class CompareAttribute extends ValidationAttribute implements IClientValidatable

The CompareAttribute type exposes the following members.

Public methodCompareAttributeInitializes a new instance of the CompareAttribute class.

Public propertyErrorMessage (Inherited from ValidationAttribute.)
Public propertyErrorMessageResourceName (Inherited from ValidationAttribute.)
Public propertyErrorMessageResourceType (Inherited from ValidationAttribute.)
Protected propertyErrorMessageString (Inherited from ValidationAttribute.)
Public propertyOtherPropertyGets the property to compare with the current property.
Public propertyOtherPropertyDisplayNameGets the other properties display name.
Public propertyRequiresValidationContext (Inherited from ValidationAttribute.)
Public propertyTypeId (Inherited from Attribute.)

Public methodEquals (Inherited from Attribute.)
Protected methodFinalize (Inherited from Object.)
Public methodFormatErrorMessageApplies formatting to an error message based on the data field where the compare error occurred. (Overrides ValidationAttribute.FormatErrorMessage(String).)
Public methodStatic memberFormatPropertyForClientValidationFormats the property for client validation by prepending an asterisk (*) and a dot.
Public methodGetClientValidationRulesGets a list of compare-value client validation rules for the property using the specified model metadata and controller context.
Public methodGetHashCode (Inherited from Attribute.)
Public methodGetType (Inherited from Object.)
Public methodGetValidationResult (Inherited from ValidationAttribute.)
Public methodIsDefaultAttribute (Inherited from Attribute.)
Public methodIsValid(Object) (Inherited from ValidationAttribute.)
Protected methodIsValid(Object, ValidationContext)Determines whether the specified object is equal to the compared object. (Overrides ValidationAttribute.IsValid(Object, ValidationContext).)
Public methodMatch (Inherited from Attribute.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Public methodValidate(Object, String) (Inherited from ValidationAttribute.)
Public methodValidate(Object, ValidationContext) (Inherited from ValidationAttribute.)

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.