Question

I am rather new to mvc2 and when following a writeup on data annotations and such, I came across a bit of code that let me manually add a line of text to the validation summary.

I've searched for the last 2 or 3 hours and I've come to the point where I think I'm just searching for the wrong thing. Its not custom validators I'm looking for, but something that I can call from the controller to add error messages.

Does anyone know what I'm talking about?

edit: clarified title a bit

Was it helpful?

Solution

Are you looking for:

ModelState.AddModelError("*", "There was an error processing your request")

MSDN - ModelStateDictionary.AddModelError Method (String, String)
MSDN - Validating Model Data in an MVC Application

HTHs,
Charles

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top