开发者

Validate and display error messages for fields not in model

开发者 https://www.devze.com 2023-01-22 19:12 出处:网络
For fields like Retype Password, Accept Terms and Conditions 开发者_如何学编程what is the best strategy to validate these fields both on the server and the client?I used DataAnnotations and add the re

For fields like Retype Password, Accept Terms and Conditions 开发者_如何学编程what is the best strategy to validate these fields both on the server and the client?


I used DataAnnotations and add the required, or other validation attributes. Then I use jQuery (or MS Validation) for client side. All is generated if you do it this way.

If you have fields that are not in your regular model, I create new "view" models that match the view. Make your life easier and do this!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号