Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CompareAttribute Class
Collapse the table of content
Expand the table of content

CompareAttribute Class

 
Note: This API is now obsolete.

Provides an attribute that compares two properties of a model.

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


[ObsoleteAttribute("The recommended alternative is to use the System.ComponentModel.DataAnnotations.CompareAttribute type, which has the same functionality as this type.")]
[AttributeUsageAttribute(AttributeTargets.Property)]
public class CompareAttribute : ValidationAttribute, IClientValidatable

NameDescription
System_CAPS_pubmethodCompareAttribute(String)

Initializes a new instance of the CompareAttribute class.

NameDescription
System_CAPS_pubpropertyErrorMessage

(Inherited from ValidationAttribute.)

System_CAPS_pubpropertyErrorMessageResourceName

(Inherited from ValidationAttribute.)

System_CAPS_pubpropertyErrorMessageResourceType

(Inherited from ValidationAttribute.)

System_CAPS_protpropertyErrorMessageString

(Inherited from ValidationAttribute.)

System_CAPS_pubpropertyOtherProperty

Gets the property to compare with the current property.

System_CAPS_pubpropertyOtherPropertyDisplayName

Gets the other properties display name.

System_CAPS_pubpropertyRequiresValidationContext

(Inherited from ValidationAttribute.)

System_CAPS_pubpropertyTypeId

(Inherited from Attribute.)

NameDescription
System_CAPS_pubmethodEquals(Object)

(Inherited from Attribute.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodFormatErrorMessage(String)

Applies formatting to an error message based on the data field where the compare error occurred.(Overrides ValidationAttribute.FormatErrorMessage(String).)

System_CAPS_pubmethodSystem_CAPS_staticFormatPropertyForClientValidation(String)

Formats the property for client validation by prepending an asterisk (*) and a dot.

System_CAPS_pubmethodGetClientValidationRules(ModelMetadata, ControllerContext)

Gets a list of compare-value client validation rules for the property using the specified model metadata and controller context.

System_CAPS_pubmethodGetHashCode()

(Inherited from Attribute.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodGetValidationResult(Object, ValidationContext)

(Inherited from ValidationAttribute.)

System_CAPS_pubmethodIsDefaultAttribute()

(Inherited from Attribute.)

System_CAPS_pubmethodIsValid(Object)

(Inherited from ValidationAttribute.)

System_CAPS_protmethodIsValid(Object, ValidationContext)

Determines whether the specified object is equal to the compared object.(Overrides ValidationAttribute.IsValid(Object, ValidationContext).)

System_CAPS_pubmethodMatch(Object)

(Inherited from Attribute.)

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodValidate(Object, String)

(Inherited from ValidationAttribute.)

System_CAPS_pubmethodValidate(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.

Return to top
Show:
© 2015 Microsoft