开发者

mvc CompareAttribute not showing up even if referenced System.Web.Mvc

I have a problem using Compare on my model. I want compare two fields, password and confirmpassword respectively and after some thorough search I found out that I can use the "CompareAttribute" so I thought it'll be on the dataannotation namespace but it isn't. Realizing that I was looking at the wrong one I search as to where and soon found out that it's on System.Web.Mvc. But the problem is, it wasn't finding it (red squiggly lines showing)..

Ok so I looked at my references开发者_运维知识库 and viewed the System.Web.Mvc dll and it has two instances, 1 with a [2.0.0.0] and another with a [3.0.0.0]. the version 3 has the CompareAttribute but I can't seem to access it.. Am I supposed to manually direct the project to look at the version 3? If so, how?


You should not have any reference to the System.Web.Mvc V2 assembly in an ASP.NET MVC 3 application. You should only use System.Web.Mvc V3 which contains the Compare attribute. If you are still using an old version of ASP.NET MVC you may take a look at the upgrate notes. You should also be targeting .NET 4.0.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜