.NET 4 MVC 2 Validation with annotations warning instead of error

后端 未结 5 1387
轮回少年
轮回少年 2020-12-30 07:53

I am using .NET 4 with MVC 2 for validating with Annotations. Is there a (simple) solution for giving back a warning instead of the error?

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 08:36

    I dont think there is any proper need to use annotations and validate data using it here. The best thing to do here is to may be write a JS function that shows a tool-tip type of message when the user gives some input that fails some input condition, as you are anyways going to allow it. The basic purpose of data annotations is to not allow inputs that fails the defined conditions to reach the db.

提交回复
热议问题