How to change 'data-val-number' message validation in MVC while it is generated by @Html helper

后端 未结 14 1733
面向向阳花
面向向阳花 2020-11-28 03:44

Assume this model:

Public Class Detail
    ...
    
    
         


        
14条回答
  •  旧时难觅i
    2020-11-28 04:20

    You can set ResourceKey of ClientDataTypeModelValidatorProvider class to name of a global resource that contains FieldMustBeNumeric key to replace mvc validation error message of number with your custom message. Also key of date validation error message is FieldMustBeDate.

    ClientDataTypeModelValidatorProvider.ResourceKey="MyResources"; // MyResource is my global resource
    

提交回复
热议问题