The type or namespace name 'IClientValidatable

2020-02-16 03:08发布

问题:

I have created a custom attribute in my asp.net MVC application using the following link:

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

but I am getting following errors:

Error 52 The type or namespace name 'IClientValidatable' could not be found (are you missing a using directive or an assembly reference?)
Error 53 The type or namespace name 'ModelClientValidationRule' could not be found (are you missing a using directive or an assembly reference?) Error 54 The type or namespace name 'ModelMetadata' could not be found (are you missing a using directive or an assembly reference?) Error 55 The type or namespace name 'ControllerContext' could not be found (are you missing a using directive or an assembly reference?)

I am using asp.net MVC 4 beta.

I tried to add reference of asp.net.MVC to the project but it is not available in add reference dialogue.

Please suggest how to fix it

回答1:

Make sure you have added using System.Web.Mvc; to the top of your file which is the namespace in which this class is defined.