使用比较验证器验证器比较2个texbox之间的日期 [英] compare dates between 2 texboxes using compare validator validator

查看:78
本文介绍了使用比较验证器验证器比较2个texbox之间的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

两个文本框开始日期和结束日期。我要求结束日期文本框中的值大于开始日期。我使用:= -

Two textboxes startdate and end date. I require value in the end date textbox greater than start date. I use:=--

<asp:CompareValidator ID="CompareValidator4" runat="server"

                    ControlToCompare="TxtEveryDayStartDate" ControlToValidate="TxtEveryDayEndDate"

                    CultureInvariantValues="True" ValidationGroup="Date"

                    ErrorMessage="Date should be greater than start date."

                    Operator="GreaterThan" SetFocusOnError="True"></asp:CompareValidator>







但是当我们使用日历控制输入值时,日期如2014年7月26日和2014年8月1日,它会给出错误消息但是实际上是1月8日是更大。解决这个问题。




But when we enter value using calender control, date like 26 july 2014 and 1 aug 2014, it gives error message but actully 1 aug is greater. Solve this plz.

推荐答案

尝试

使用ASP.Net CompareValidator 以dd / mm / yyyy格式比较日期[ ^ ]

使用ASP.Net中的比较验证器验证未来日期 [ ^ ]

使用比较验证器验证日期 [ ^ ]
Try
Compare dates in dd/mm/yyyy format using ASP.Net CompareValidator[^]
Validation of future date using compare validator in ASP.Net[^]
validation for date using compare validator[^]


在VB.net中我使用以下代码...尝试使用此逻辑



In VB.net i use following code...try to use this logic

If Date.Parse(startdate) > Date.Parse(enddate) Then
    MsgBox("true")
End If


这篇关于使用比较验证器验证器比较2个texbox之间的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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