MVC3 edit for decimal fields and localization

前端 未结 2 767
闹比i
闹比i 2020-12-31 12:54

My locale uses a comma ,, and not a dot . for decimal separator.

In MVC3, when I open an Edit view where the decimal values are shown with

2条回答
  •  感情败类
    2020-12-31 13:06

    Getting around with this by tweaking your validation logic has been already explained so here is a different approach.

    Put the below code inside your web.config file under the node if you would like to set the culture to en. It will take care of decimal delimiter:

    
    

    I am not sure but for DateTime, you are still bound to your server's locale.

提交回复
热议问题