Reputation: 132
i need to write a registration form and need to [Compare] attribute for my Confirm Password field. i'm using MVC 4 . Is there this attribute in mvc 4? if answer is yes what namespace need to use?
Upvotes: 0
Views: 1163
Reputation: 18639
As of MVC4, the [Compare]
attribute is potentially in two different namespaces:
The Mvc version is IClientValidatable
and all the benefits that brings - front end validation etc..
With Asp.NET Mvc 5 the System.Web.Mvc one is marked as obsolete, which may be something to bear in mind if you are going to be migrating upwards soon.
If your model mixes the two namespaces above, you can expicitly choose which one to use my using the full namespace - e.g. [System.Web.Mvc.Compare( .. )]
Upvotes: 1