法语日期格式验证数据转换C# [英] French Date Format Validation Data Anotation C#

查看:76
本文介绍了法语日期格式验证数据转换C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ASP .Net MVC 4开发一个应用程序,它是基于法语的,几乎我在我的应用程序中的处理,基于日期。



对于日期文本字段,我使用jQuery DatePicker,我禁用手动修改字段。



在我的模型中,我添加



 [DataType(DataType.Date)] 





但是在提交表格时,日期如果日期格式为dd / MM / yyyy,则字段未验证,但是当日期格式为MM / dd / yyyy时,验证没有问题。



我试图更改我的应用程序的区域设置&使用jQuery.Globalize但没有解决方案!错误消息是:值«29/04/2014»不是Date d'effet的有效格式。 (该消息以法语显示,但我为了更加理解而引用它。)



你能帮助我吗?

解决方案

I am developping an application with ASP .Net MVC 4 which is french language based, almost of the treatements i have in my app, are based on dates.

For the date textfield i use jQuery DatePicker and i disable hand modifyig fields.

In my Model, i add

[DataType(DataType.Date)]



But when submiting form, the Date Field Is not Validated if the date format is dd/MM/yyyy , but when the date format is MM/dd/yyyy, there is no problems of validation.

I tried to change the locale of my application & used jQuery.Globalize but no solution ! The error message is : The value « 29/04/2014 » is not a valid format for Date d'effet. (The message was displayed in french, but i traduce it for more comprehension).

Could you help me?

解决方案

这篇关于法语日期格式验证数据转换C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆