What version of DataAnnotations is included with ASP.NET MVC 2 RTM
Posted
by Nick Thoresby
on Stack Overflow
See other posts from Stack Overflow
or by Nick Thoresby
Published on 2010-05-13T20:47:49Z
Indexed on
2010/05/13
20:54 UTC
Read the original article
Hit count: 271
I'm working on a project using Visual Studio 2008 and have moved from the the MVC 2 Preview to RTM version. We would like to use model validation such as:
public class ViewModel
{
[Required(ErrorMessage="UserName is required.")]
[StringLength(10, ErrorMessage="UserName cannot be greater than 10 chars.")]
public string UserName { get; set; }
}
[HttpPost]
public ActionResult Register(ViewModel model)
{
if (ModelState.IsValid){} // Always true
}
However the ModelState.IsValid always returns true. I have a suspicion that it might be something to do with the version of System.ComponentModel.DataAnnotations.dll that we are referencing, currently version 99.0.0.0, which seems rather odd.
Does anyone know what version of this dll is included with the MVC 2 RTM for Visual Studio 2008?
© Stack Overflow or respective owner