DataForm: Nullable int property is validated against range when no data is input.
Nullable int property is validated against range when no data is input.
1 comment
ADMIN
Petar Marchev
Posted on:29 May 2018 08:35
We declined this item because this behavior is by design - a null value does not fall within a numeric range. For users that want to allow a null value to pass validation, this can be achieved by inheriting the NumericalRangeValidatorAttribute class and overriding the ValidateCore method.
protected override bool ValidateCore(object value)
{
if (value == null)
{
return true;
}
return base.ValidateCore(value);
}