范围验证控制的问题 [英] problem with range validation control

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

问题描述

<form id="Form1"  runat="server">
Enter a date between 2005-01-01 and 2005-12-31:
<br />
<asp:TextBox id="tbox1" runat="server" />
<br /><br />
<asp:Button ID="Button1" Text="Submit" runat="server" />
<br /><br />
<asp:RangeValidator ID="RangeValidator1"

ControlToValidate="tbox1"

MinimumValue="01/08/2012"

MaximumValue="20/08/2012"



EnableClientScript="false"

Text="The date must be between 2005-01-01 and 2005-12-31!"

runat="server" />
</form>




在上面的代码中,它取的最小值为20/07/2012
为什么会这样....
我该如何解决这个问题....




In above code it is taking minimum value 20/07/2012
why it is taking like that ..
how can i solve this issue....

推荐答案

在上面的代码中,您没有将Type添加为RangeValidator作为日期,

In your Above Code you Don''t Added Type into RangeValidator as Date,

<div>
        Enter a date between 2005-01-01 and 2005-12-31:
        <br />
        <asp:TextBox ID="tbox1" runat="server" />
        <br />
        <br />
        <asp:Button ID="Button1" Text="Submit" runat="server" />
        <br />
        <br />
        <asp:RangeValidator ID="RangeValidator1" ControlToValidate="tbox1" MinimumValue="2005-01-01"
            MaximumValue="2005-12-31" EnableClientScript="false" Text="The date must be between 2005-01-01 and 2005-12-31!"
            runat="server" Type="Date" />
    </div>



现在输入2005年1月1日至2005年12月31日之间的日期
正确运作
希望它对您有帮助
谢谢.



Now Enter Date Between 2005-01-01 to 2005-12-31
It work Proper
Hope its Help You
Thank You.


阅读有关如何使用RangeValidator的信息.

您正在尝试检查数据类型日期的范围.试试:
Read on how to use RangeValidator.

You are trying to check for a range of datatype date. Try:
<asp:RangeValidator ID="RangeValidator1"

ControlToValidate="tbox1"

MinimumValue="01/08/2012"

MaximumValue="20/08/2012"

Type="Date"

EnableClientScript="false"

Text="The date must be between 2005-01-01 and 2005-12-31!"

runat="server" />


参考:
MSDN:BaseCompareValidator.Type属性 [ ^ ]
MSDN:RangeValidator控件(常规参考) [


Refer:
MSDN: BaseCompareValidator.Type Property [^]
MSDN: RangeValidator Control (General Reference)[^]


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

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