I want to prevent a user from entering a TimeZoneId
of type string
. Currently, the validation is not catching this issue. How can I prevent a user from entering a string value?
Validator in my Provider:
Currently, my AddValidator
prevents a user from entering a null value
AddValidator(p => p.TimeZoneID != null && projectValidator.IsTimeZoneIdInvalid(p.TimeZoneID.Value), "TimeZoneId", "Invalid time zone ID");
I've tried adding the following, but it doesn't work. It returns an error stating Cannot apply operator '!=' to operands of type 'System.Nullable':
AddValidator(p => p.TimeZoneID != null && p.TimeZoneID != typeof(string) && projectValidator.IsTimeZoneIdInvalid(p.TimeZoneID.Value), "TimeZoneId", "Invalid time zone ID");