用于验证日期的正则表达式 [英] Regular expression to validate Date
本文介绍了用于验证日期的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用正则表达式或其他方法(Javascript等)验证所选日期应大于当前日期.
I want to validate the selected date should be greater than the current date using regular expression or some other method( Javascript etc)
推荐答案
如果您使用的是日历控制您可以按照以下方式进行操作:
If you are using calendar control you can do this as :
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.Date <= DateTime.Today.Date)
{
e.Cell.Enabled= false; // Changes the Cells Enable Property
e.Day.IsSelectable = false; // Disables the Cells Click Property
}
}
有关更多信息,请参见: http://www.dotnetfunda.com/articles/article600-customising-the-calendar-control-in-aspnet.aspx [ https://forums.asp.net/t/1615792.aspx?CalendarExtender+date+checker [^ ]
for more refer :http://www.dotnetfunda.com/articles/article600-customising-the-calendar-control-in-aspnet.aspx[^]
or while using a Ajax Calendar Extender control you can do as something explained here :
https://forums.asp.net/t/1615792.aspx?CalendarExtender+date+checker[^]
这篇关于用于验证日期的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文