How to set the Min Value to 15 days after current date of RangeValidator?

204 Views Asked by At

I have an ajaxToolkit:CalendarExtender who keeps the selected date on a textbox. I want to validate that the selected date is 15 days after current date.

I set the min value, but I get the error when the page id loading:

The MaximumValue cannot be less than the MinimumValue 4 Jun 2019 of RangeValidator1.

The max value doesn't matter.

RangeValidator1.MinimumValue = System.DateTime.Now.AddDays(15).ToShortDateString();

To load the page and the textbox to allow dates after the current date with 15 days.

1

There are 1 best solutions below

2
jonaChaz On

I think you need to set the maximum value:

RangeValidator1.MaximumValue = System.DateTime.MaxValue.ToShortDateString();