I am trying to validate a form using ModelState generally the same way as in tutorials on asp.net/mvc. However I dont have my own database or their objects and want to valid
So, for every error you add with ModelState.AddModelError() and call the View again, MVC Framework will try to find an AttemptedValue for every error it finds. Because you didn't add them, MVC will throw an exception.
http://forums.asp.net/p/1396019/3006051.aspx
If there are errors then you must also set the model value as well as the modal error
ModelState.AddModelError("Some_Key","Show some error message"); ModelState.SetModelValue("Some_Key", ValueProvider["Some_Key"]);