数据注释不绑定到模型状态错误 - MVC4 RC [英] Data Annotations not binding to model state errors - MVC4 RC

查看:56
本文介绍了数据注释不绑定到模型状态错误 - MVC4 RC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经安装了 MVC 4 RC ,我的应用程序中有一个模型,其中我使用了
DataAnnotation Attribute 表示该模型中的属性,如下所示。   

   公共类MyModel    {                    [必需]鸟      public int Id {get;组; }   } 

但是当服务器执行模型验证时,错误消息未绑定到模型状态错误,并显示以下错误,  ;" 显示  Newtonsoft.Json.JsonReaderException:无法将字符串转换为整数"。


请有人帮忙解决此问题。


谢谢


Sakthi VS


解决方案

您似乎遇到了MVC 4 Web应用程序的问题。


此论坛特定于Visual Studio内置的帮助系统。


如需最佳建议,请尝试在此处发布:


http://forums.asp.net/1213.aspx/1?Visual+Studio+and+Visual+Web+Developer+Express


Hi,

I Have installed MVC 4 RC and i have a model in my Application, in which i have used DataAnnotation Attribute for a property in that model as shown below.   

    public class MyModel    {                     [Required]        public int Id{ get; set; }   }

But when the server performs model validation the error message is not binding to the model state errors, and showing the following error,  "showing Newtonsoft.Json.JsonReaderException: Could not convert string to integer".

Please could someone help with this.

Thanks

Sakthi VS

解决方案

You appear to have an issue with a MVC 4 web application.

This forum is specific to the Help System built into Visual Studio.

For best suggestions, please try posting here:

http://forums.asp.net/1213.aspx/1?Visual+Studio+and+Visual+Web+Developer+Express


这篇关于数据注释不绑定到模型状态错误 - MVC4 RC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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