asp.net - 停止掩码附加 '0'

标签 asp.net .net

使用输入掩码时,如果输入不满足掩码长度,则字段将追加“0”。

掩码如下:

<cc1:MaskedEditExtender ID="MaskedEditExtender2" 
     runat="server" 
     ClearMaskOnLostFocus="true" 
     Mask="9-999999999999" 
     MaskType="Number" 
     TargetControlID="Sub_Ord_NumTextBox" 
     OnInvalidCssClass="MaskedEditError" 
     AutoComplete="true"/>

像这样的数字:

1-123456789123

(14个字符,与掩码匹配)

不错,但有一个喜欢

1-12345678912

(13 个字符)

将导致保存的字段添加零:

1-123456789120

如何防止这种情况发生?

最佳答案

the documentation 的大力帮助下解决了这个问题!

AutoComplete - True to automatically fill in empty mask characters not specified by the user

MaskType=Number - Empty mask characters will be filled with zeros

MaskType=Time - Empty mask characters will be filled with the current time

MaskType=Date - Empty mask characters will be filled with the current date

MaskType=DateTime - Empty mask characters will be filled with the current date/time

设置 AutoComplete = false 似乎解决了我的问题。

关于asp.net - 停止掩码附加 '0',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11641083/

相关文章:

c# - System.Uri 类 : Different escaping behaviour in Azure vs. .Net 框架

c# - 如何突出显示任务栏项目

.net - SQL Server OLAP 多维数据集(教程)

c# - 如何在 WinForms 应用程序的 Windows 安装程序期间获取用户输入?

c# - Csharp - 将单数转换为十进制而不转换为字符串

asp.net - 方法背后的代码与 Jquery AJAX 调用

javascript - 如何使用 jquery 单击文本后更改文本的颜色?

c# - 无法在 ASP.Net 中获取当前用户 IP

php - 事件目录下具有基于信任的身份验证的 JavaScript 小部件

c# - 如何在 View 状态中存储从字典继承的类的实例?