This documentation is archived and is not being maintained.

BaseCompareValidator::Compare Method (String, String, ValidationCompareOperator, ValidationDataType)

Compares two strings using the specified operator and data type. This version of the overloaded method compares currency, double, and date values using the format used by the current culture.

Namespace:  System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

protected:
static bool Compare(
	String^ leftText, 
	String^ rightText, 
	ValidationCompareOperator op, 
	ValidationDataType type
)

Parameters

leftText
Type: System::String

The value on the left side of the operator.

rightText
Type: System::String

The value on the right side of the operator.

op
Type: System.Web.UI.WebControls::ValidationCompareOperator

One of the ValidationCompareOperator values.

type
Type: System.Web.UI.WebControls::ValidationDataType

One of the ValidationDataType values.

Return Value

Type: System::Boolean
true if the leftValue parameter relates to the rightValue parameter in the manner specified by the op parameter; otherwise, false.

The Compare(String, String, ValidationCompareOperator, ValidationDataType) method is used to test whether the value of the leftText parameter relates to the value of the rightText parameter in the manner specified by the op parameter. The type parameter specifies the data type of the values being compared.

NoteNote:

If the op parameter is set to ValidationCompareOperator.DataTypeCheck, this method tests only the value of the leftText parameter for the data type specified by the type parameter. The rightText parameter is ignored.

This version of the method compares the values using the format used by the current culture. To compare the values using a culture-neutral format, use the BaseCompareValidator::Compare(String, Boolean, String, Boolean, ValidationCompareOperator, ValidationDataType) overloaded version of this method.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Show: