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

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

Assume this model:

Public Class Detail
    ...
    
    
         


        
相关标签:
14条回答
  • 2020-11-28 04:28

    I make this putting this on my view

    @Html.DropDownListFor(m => m.BenefNamePos, Model.Options, new { onchange = "changePosition(this);", @class="form-control", data_val_number = "This is my custom message" })
    
    0 讨论(0)
  • 2020-11-28 04:32

    Or you can simply do this.

    @Html.ValidationMessageFor(m => m.PercentChange, "Custom Message: Input value must be a number"), new { @style = "display:none" })
    

    Hope this helps.

    0 讨论(0)
提交回复
热议问题