The MinimumValue
and MaximumValue
properties of the RangeValidator
class return string.Empty
as their default when not set.
Next, it also happens that the Convert()
protected method implemented by BaseCompareValidator
, which is used for converting the string properties to values, calls int.Parse()
for the ValidationDataType.Integer
case. int.Parse()
doesn't like the empty string and will throw an exception.
But, in the case of ValidationDataType.Double
, Convert()
first calls another protected method, ConvertDouble()
(instead of double.Parse()
), and in that method it explicitly returns a string value of "0" when an empty string is detected, and that string value "0" later parses, via double.Parse()
into 0d
.
The integer case doesn't benefit from such a mapping of string.Empty
to "0".
Hence, the dicrepancy. The devil is in the details, and Reflector is your friend.