MVC - Change Compare attribute error message

前端 未结 2 464
有刺的猬
有刺的猬 2020-12-17 06:47

In my MVC application I have the ability to get the error message from a text file instead of using the default error message. This works perfectly on the Required attribut

2条回答
  •  天涯浪人
    2020-12-17 07:11

    Why not use something like this?

    
    

    Just create a static function that gets the error message for you. You can even take a parameter for your GetErrorMessage function so you can determine which message you'll want to return.

提交回复
热议问题