简体   繁体   English

如何在RangeValidator的当前日期之后将最小值设置为15天?

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

I have an ajaxToolkit:CalendarExtender who keeps the selected date on a textbox. 我有一个ajaxToolkit:CalendarExtender,它将所选日期保留在文本框中。 I want to validate that the selected date is 15 days after current date. 我想验证所选日期是当前日期之后的15天。

I set the min value, but I get the error when the page id loading: 我设置了最小值,但是当页面ID加载时我收到错误:

The MaximumValue cannot be less than the MinimumValue 4 Jun 2019 of RangeValidator1. MaximumValue不能小于RangeValidator1的2019年6月4日的MinimumValue。

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. 加载页面和文本框以允许当前日期之后的日期为15天。

我认为你需要设置最大值:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM