System.Web.UI.WebControls.BaseCompareValidator.Compare Method

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.

Syntax

protected static bool Compare (string left, bool cultureInvariantLeftText, string right, bool cultureInvariantRightText, ValidationCompareOperator op, ValidationDataType type)

Parameters

left
Documentation for this section has not yet been entered.
right
Documentation for this section has not yet been entered.
cultureInvariantLeftText
true to convert the left side value to a culture-neutral format; otherwise, false.
cultureInvariantRightText
true to convert the right side value to a culture-neutral format; otherwise, false.
op
One of the System.Web.UI.WebControls.ValidationCompareOperator values.
type
One of the System.Web.UI.WebControls.ValidationDataType values.

Returns

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

Remarks

The BaseCompareValidator.Compare(string, bool, string, bool, 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.

Note:

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.

Requirements

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