2

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

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

1 Comment

This is exactly what I was looking for. I had tried that before but was apparently using it incorrectly. Thank you very much!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.