BaseCompareValidator.Compare Method (String, Boolean, String, Boolean, ValidationCompareOperator, ValidationDataType)

Compares two strings using the specified operator and validation data type. This version of the overload allows you to specify whether values are compared using a culture-neutral format.

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

protected:
static bool Compare (
	String^ leftText, 
	bool cultureInvariantLeftText, 
	String^ rightText, 
	bool cultureInvariantRightText, 
	ValidationCompareOperator op, 
	ValidationDataType type
)
protected static boolean Compare (
	String leftText, 
	boolean cultureInvariantLeftText, 
	String rightText, 
	boolean cultureInvariantRightText, 
	ValidationCompareOperator op, 
	ValidationDataType type
)
protected static function Compare (
	leftText : String, 
	cultureInvariantLeftText : boolean, 
	rightText : String, 
	cultureInvariantRightText : boolean, 
	op : ValidationCompareOperator, 
	type : ValidationDataType
) : boolean
Not applicable.

Parameters

leftText

The value on the left side of the operator.

cultureInvariantLeftText

true to convert the left side value to a culture-neutral format; otherwise, false.

rightText

The value on the right side of the operator.

cultureInvariantRightText

true to convert the right side value to a culture-neutral format; otherwise, false.

op

One of the ValidationCompareOperator values.

type

One of the ValidationDataType values.

Return Value

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

The Compare(String,Boolean,String,Boolean,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.

To indicate that values should be compared using a culture-neutral format, pass in true for the cultureInvariantLeftText and cultureInvariantRightText parameters; otherwise, the values are compared using the format used by the current culture. When comparing values using the format used by the current culture, consider using the BaseCompareValidator.Compare(String,String,ValidationCompareOperator,ValidationDataType) overloaded version of this method.

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show: