找不到类型或命名空间名称“IClientValidatable”

时间:2012-05-01 14:13:02

标签: asp.net-mvc asp.net-mvc-3

我使用以下链接在我的asp.net MVC应用程序中创建了一个自定义属性:

http://www.falconwebtech.com/post/2012/04/18/MVC3-Custom-Validation-Attributes-for-Client-Server-Side-Validation-with-Unobtrusive-Ajax.aspx

但是我遇到了以下错误:

错误52找不到类型或命名空间名称“IClientValidatable”(您是否缺少using指令或程序集引用?)
错误53找不到类型或命名空间名称“ModelClientValidationRule”(您是否缺少using指令或程序集引用?) 错误54找不到类型或命名空间名称“ModelMetadata”(您是否缺少using指令或程序集引用?) 错误55找不到类型或命名空间名称“ControllerContext”(您是否缺少using指令或程序集引用?)

我使用的是asp.net MVC 4 beta。

我尝试将asp.net.MVC的引用添加到项目中,但在添加引用对话框中不可用。

请建议如何修复它

1 个答案:

答案 0 :(得分:2)

确保已将using System.Web.Mvc;添加到文件的顶部,该文件是定义此类的命名空间。