CompareValidator格式的问题 [英] Problem with CompareValidator Format

查看:79
本文介绍了CompareValidator格式的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先是我的代码,我有2个CalendarExtender



First here is my code, I have 2 CalendarExtender

<asp:TextBox ID="date_from" runat="server" TextMode="DateTime" Width="80px"></asp:TextBox><asp:ImageButton runat="Server" ID="ImageButton1" ImageUrl="~/images/ico_calendar.gif" AlternateText="Click here to display calendar" />
<cc1:CalendarExtender ID="CalendarExtender1"  runat="server" TargetControlID="date_from" PopupButtonID="ImageButton1" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy"></cc1:CalendarExtender>







<asp:TextBox ID="date_to" runat="server" TextMode="DateTime" Width="80px"></asp:TextBox>
<asp:ImageButton runat="Server" ID="ImageButton2" ImageUrl="~/images/ico_calendar.gif" AlternateText="Click here to display calendar" />
<cc1:CalendarExtender ID="CalendarExtender2"  runat="server" TargetControlID="date_to" PopupButtonID="ImageButton2" Format="dd/MM/yyyy" TodaysDateFormat="dd/MM/yyyy"></cc1:CalendarExtender>





和CompareValidator:



And the CompareValidator:

<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="From Date must be earlier than To Date" ControlToCompare="date_from" ControlToValidate="date_to" type="Date" Operator="GreaterThanEqual" display="Dynamic" enableclientscript="true" cultureinvariantvalues="true" ForeColor="red"></asp:CompareValidator>





问题是我希望格式为dd / MM / yyyy。当我选择此日期范围:03/09/2013 - 02/11/2013时,它会触发错误日期必须早于到日期。



想知道如何制作CompareValidator格式dd / MM / yyyy。



The Problem is I want the format to be dd/MM/yyyy. When I choose this date range: 03/09/2013 - 02/11/2013 it is triggering the error "Date must be earlier than To Date".

ANy idea how to make the CompareValidator format dd/MM/yyyy.

推荐答案

这是很好的链接解释了你遇到的同样问题。检查一下。



如何使用比较验证器与日期的dd / MM / yyyy格式



另一个链接: SOF





我希望这会对你有所帮助。
Here is the Good link which explains same issue where you're having.Check this.

How to use compare validator with dd/MM/yyyy format of date

Another Link : SOF


I hope this will help to you.


这篇关于CompareValidator格式的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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