Featured On ...

asp.net

totalasp.co.uk

fuzzysoftware.com

devdex.com

123aspx.com

dotnetfreaks.com

411asp.net

and more ...

ValidatorEntryComparer

Full path

MadWidgets.Validation.ValidatorEntryComparer

Declaration

public abstract class ValidatorEntryComparer : ValidatorEntryClientServer

Hierarchy

Click on the selected class to view any properties or methods that may be accessible through an instance of this class through inheritance.

ValidatorEntryComparer

Overview

The ValidatorEntryComparer class is the base class for all validation entries that are used to compare two related objects (e.g. form fields). The types of comparison available are found in the MadWidgets.Validation.ComparisonMethod enumeration. The following table lists the constants found in this enumeration and their meaning:

Comparison method ComparisonMethod* enumeration constant
Equals EqualTo
Not equals NotEqualTo
Less than LessThan
Less than or equal to LessThanOrEqualTo
Greater than GreaterThan
Greater than or equal to GreaterThanOrEqualTo

* NOTE: In version 1.2 and below, the ComparisonMethod enumeration is called CompareMethod.

Constructors

Public properties

Public methods

Protected methods


Constructors

ValidatorEntryComparer

public ValidatorEntryComparer(object o1, object o2, ComparisonMethod cm, string sMessage, string sHighlightElement)

Creates a ValidatorEntryComparer based on the two input objects o1 and o2 and a compare method together with a message and a client-side highlight element signature.

Public properties

FirstObject

public override string FirstObject {get;}

Overrides the property of the same name from the ValidatorEntry class and returns the object passed as o1 in the constructor.

Public methods

ContainsObject

public override bool ContainsObject(object o)

Overrides the method of the same name from the ValidatorEntry

Protected methods

ClientSideOperator

protected string ClientSideOperator()

Returns the Javascript eqivalent operator of the compare mode passed in the constructor.

ClientSideValueConversionCode

protected virtual string ClientSideValueConversionCode(string sValueId, int iObjectNr)

Designed to be overridden by ValidatorEntryComparer subclasses, this method should return Javascript code that converts the value represented by the client-side variable name in sValueId into a form that can be validated by the client-side validator code. For example, if the comparer was an integer comparer and the variable represented by sValueId was a string value representing an integer, then you might return "parseInt(" + sValueId + ")" from this method.

The parameter iObjectNr can be either 1 or 2 indicating which of the two validated objects supplied in the constructor is being referenced by the variable name found in sValueId. Some ValidatorEntryComparer subclasses manipulate the value of either the first or the second object before returning it.

GetObjectValue

protected abstract IComparable GetObjectValue(object o, int iObjectNr)

This method must be overridden by subclasses. The method must return an IComparable that is the equivalent value of the value of the object passed to it. You can obtain the value of this object by calling GetValidationValue(o) of the ValidatorEntry class.

GetValidationValue(o) always returns a string, so this method must convert the string to a type that is compatible with the basic type being validated by the comparer.

The parameter iObjectNr can be either 1 or 2 indicating which of the two validated objects supplied in the constructor is being referenced by the variable name found in sValueId. Some ValidatorEntryComparer subclasses manipulate the value of either the first or the second object before returning it.

© 2002 - 2009 Copyright, Disclaimer and Privacy Statement