ASP.NET MVC Html.ValidationSummary(true) does not display model errors

I have some problem with Html.ValidationSummary. I don’t want to display property errors in ValidationSummary. And when I set Html.ValidationSummary(true) it does not display error messages from ModelState. When there is some Exception in controller action on string MembersManager.RegisterMember(member); catch section adds an error to the ModelState: ModelState.AddModelError(“error”, ex.Message); But ValidationSummary does not display this … Read more

ModelState.AddModelError – How can I add an error that isn’t for a property?

I am checking my database in Create(FooViewModel fvm){…} to see if the fvm.prop1 and fvm.prop2 already exist in that combination; if so, I want to add an error to the modelstate, then return the whole view. I tried: public ActionResult Create(FooViewModel fvm){ if (ThatComboAlreadyExists(fvm)) { ModelState.AddModelError(“Model”, “There is already one like that”); return View(fvm); } … Read more