We have couple of masked textboxes Phone,Mobile) with proper masking but can't able to set the length validation. display:none is set automatically which bared validation message to be display over UI. Please help.
我们有几个屏蔽文本框Phone,Mobile)具有适当的屏蔽但无法设置长度验证。显示:无自动设置,无需通过UI显示验证消息。请帮忙。
1 个解决方案
#1
0
It is better to use data annotations in your model to set length for your input. If it is digits use something like:
最好在模型中使用数据注释来设置输入的长度。如果是数字,请使用以下内容:
[StringLength(int.MaxValue, MinimumLength = 7)]
If it is string use something like:
如果是字符串使用类似于:
[RegularExpression(@"^(?:.*[a-z]){7,}$", ErrorMessage = "String length must be greater than or equal 7 characters.")]
#1
0
It is better to use data annotations in your model to set length for your input. If it is digits use something like:
最好在模型中使用数据注释来设置输入的长度。如果是数字,请使用以下内容:
[StringLength(int.MaxValue, MinimumLength = 7)]
If it is string use something like:
如果是字符串使用类似于:
[RegularExpression(@"^(?:.*[a-z]){7,}$", ErrorMessage = "String length must be greater than or equal 7 characters.")]