日期/时间范围验证器ASP.Net [英] Date/Time Range Validator for ASP.Net

查看:254
本文介绍了日期/时间范围验证器ASP.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

它看起来像标准的asp.net 2 RangeValidator控件不允许倍。例如01/01/2008 12时00未在我的范围接受,即使它应该是有效的。如果我删除它按预期工作的时间。

It looks like the standard asp.net 2 RangeValidator control doesn't allow times. e.g. 01/01/2008 12:00 is not accepted in my range, even though it should be valid. If I remove the time it works as expected.

有一个验证器,在那里,允许日期/时间格式?

Is there a validator out there that allows for date/time format?

我们没有AJAX扩展。理想情况下,想了preexisting控制或常规的前pression用的CustomValidator使用。验证应该是客户端,服务器验证部分很简单。

We don't have Ajax extensions. Ideally, would like a preexisting control or a regular expression to use with CustomValidator. Validation should be client side, the server validation part is easy.

我们用这个正则表达式:

We used this RegExp:

http://regexlib.com/REDetails.aspx?regexp_id=610

推荐答案

您可以使用自定义验证并手动进行检查。

You could use a custom validator and perform the check manually.

下面是一个简单的例子或你可以谷歌asp.net定制验证器。如果排除的ControlToValidate属性,那么你可以验证对多个字段。

Here's a quick example or you can Google "asp.net custom validator". If you exclude the "ControlToValidate" property then you can validate against multiple fields.

这篇关于日期/时间范围验证器ASP.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆