使用输入掩码时,如果输入不满足掩码长度,则字段将追加“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/