BaseCompareValidator::CanConvert Method (String, ValidationDataType, Boolean)
Determines whether the specified string can be converted to the specified data type. This version of the overloaded method allows you to specify whether values are tested using a culture-neutral format.
Assembly: System.Web (in System.Web.dll)
public: static bool CanConvert( String^ text, ValidationDataType type, bool cultureInvariant )
Parameters
- text
- Type: System::String
The string to test.
- type
- Type: System.Web.UI.WebControls::ValidationDataType
One of the ValidationDataType enumeration values.
- cultureInvariant
- Type: System::Boolean
true to test values using a culture-neutral format; otherwise, false.
Return Value
Type: System::Booleantrue if the specified data string can be converted to the specified data type; otherwise, false.
Use the CanConvert(String, ValidationDataType, Boolean) method to determine whether the specified string can be converted to the specified data type. This method is commonly used to test whether a string can be converted to a compatible data type before performing an operation that depends on that data type. To indicate that values should be tested using a culture-neutral format, pass in true for the cultureInvariant parameter; otherwise, values are tested using the format used by the current culture. When testing a value using the format used by the current culture, consider using the BaseCompareValidator::CanConvert(String, 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.