今天在Asp.net中的日期或未来日期验证 [英] Today Date or Future Date Validation in Asp.net
本文介绍了今天在Asp.net中的日期或未来日期验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好我想验证文本框是否用户输入日期是今天或未来日期,但它不能是过去日期。我如何在Asp.Net中为其创建代码 - 源代码页
你能帮助我吗?
Hi i want to validate the text box whether the user entered the Date is Today or Future Date but it must not be the Past Date. how can i make code for that in Asp.Net - Source Code Page
can u help me?
推荐答案
你可以使用ajax CalendarExtender为此
u can use ajax CalendarExtender for this
简单:将用户输入的日期转换为DateTime值并在代码隐藏中进行比较:(假设您的意思是源代码页)
Simple: convert the user entered date to a DateTime value and compare it in the codebehind: (assuming that is what you mean by "source Code page")
if (userDate < DateTime.Now)
{
// It's in the past
...
}
这篇关于今天在Asp.net中的日期或未来日期验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文