当使用Masktype时间MaskedEditExtender,如何覆盖的不良行为? [英] When using a MaskedEditExtender of Masktype Time, how to Override an Undesirable Behavior?

查看:202
本文介绍了当使用Masktype时间MaskedEditExtender,如何覆盖的不良行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面两行正常工作时,可以正确指定的输入:

The following two lines work fine when input is correctly specified:

<asp:TextBox ID="MondayOpenTextBox" runat="server" MaxLength="5" />
<Ajax:MaskedEditExtender ID="MondayOpenMaskedEditExtender" runat="server" 
    TargetControlID="MondayOpenTextBox" AcceptAMPM="false" MaskType="Time" 
    Mask="99:99" />

如果用户输入12,然后按Tab切换到下一个领域,分钟,并填充当前分钟。这是不希望的对所讨论的页。我想无论是喜欢弹出一个错误信息,或填写00为跳过的数字。

If the user enters "12" then tabs to the next field, the minutes get populated with the current minute. This is not desirable for the page in question. I'd either like to popup an error message, or fill in "00" for the skipped digits.

这没有帮助:

<asp:RegularExpressionValidator runat="server" ID="ValidateMondayOpenTextBox" 
    ControlToValidate="MondayOpenTextBox" Display="Dynamic" ErrorMessage="X" 
    ValidationExpression="\d\d:\d\d" />

作为字段由时间显然格式化确认器得到轮到它在它

as the field is apparently formatted by the time the validator gets its turn at it.

推荐答案

您可以设置您的自动完成属性://www.asp .NET / AJAX / AjaxControlToolkit中/样品/ MaskedEdit / MaskedEdit.aspx相对=nofollow> MaskedEdit 扩展到以prevent它填满空屏蔽字符与当前时间:

You can set the AutoComplete property of your MaskedEdit extender to false in order to prevent it from filling the empty masked characters with the current time:

<Ajax:MaskedEditExtender ID="MondayOpenMaskedEditExtender" runat="server"
    TargetControlID="MondayOpenTextBox" AcceptAMPM="false" MaskType="Time"
    Mask="99:99" AutoComplete="False" />

这样,您的验证程序应能正确地完成其工作。

That way, your validator should be able to properly do its job.

这篇关于当使用Masktype时间MaskedEditExtender,如何覆盖的不良行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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