简体   繁体   中英

data annotation showing the same error even while entering same type of data

在此处输入图像描述 [:[enter image description here](https.//i.stack.imgur.com/g7m 在此处输入图像描述 FS.png)]( https://i.stack.imgur.com/g7mFS.png )

Here i tried to use data annotations, i tried to implement Range annotation on salary data type which i declared as a int type but even though i tried to enter data as integer only but still its showing error message (please enter number only) and i have tried executing without data annotations method working successfully but not working with the dataannotation range with this specific type only

HOW CAN SEARCH AND FIND THE PROBLEM TO SOLVE THIS ISSUE

The Regular expression Data Annotation is wrong. Use this instead

[RegularExpression(@"^[0-9]{4,5}$", ErrorMessage = "Please enter only numbers ")]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM