本文介绍了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.

推荐答案


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

10-12 17:32