CompareValidator Null Field

Hi there!

I have two date fields. I want to make sure dateField2 is greater than or equal to dateField1. A null dateField2 is also acceptable. The comparative operators for CompareValidator all make sense to me, I'm just not sure how to also pass validation if dateField2 is null.


Hi @chmilne,

The CompareValidator will not validate if one of the values is null. You can try setting the Visible property of the validator to false if dateField2 is null - this way it should not trigger at all: dateField2 != null

Very helpful. Thank you!!

Hi @korchev,

I did the same thing in the CompareValidator, but what happen to me is:

The validator is not working when I do put value in the DatePicker.

This thread is for Blazor applications and as far as I remember you are using Angular. Start a new thread and describe your problem.