MVC3 Validation with ComponentModel.DataAnnotations for UK date format (also using jquery ui datepicker)

前端 未结 6 900
后悔当初
后悔当初 2021-01-05 14:25

I see there are some similar questions to this, but none solve my issue.

I am working on an MVC3 app with Entity Framework 4.3. I have a UK date field that i plan t

6条回答
  •  感情败类
    2021-01-05 15:06

    I've had this problem just now, took me hours to track down the reason. I'm not saying this is your issue but after having spent hours switching globalisations on everything, etc. i thought I'd post the issue on here for any people struggling like me.

    Anyway, the problem in my project was actually not what i thought it was. I had decorated the property with [DataAnnotationsExtentions.Date] which, it turns out, mucks up the client side validation in chrome when it comes to the localisation (i.e if you want a day after the 12th in England) although it seems to work fine in other browsers. As soon as I removed that it worked

提交回复
热议问题