javascript - server side validation, how to pass errors to view in MVC? -


Using .net MVC and I am verifying some server side in my work which handles the post of the form.

What is a good technique to look back at the errors?

I'm thinking of creating an error archive, adding my archive and then displaying some javascript (using jQuery) error.

It would be nice to have an error in some of the jQuery automated ways because it is a normal pattern.

What do you do?

You want to add errors to the ModelState because @Mehardhad points out.

  ... hold (argument OUTOfRangeException e) {ModelState.AddModelError (e.ParamName, e.Message); Result = view ("new"); }  

and include validation summaries in your view

  <% = HTML.ValidationSummary ()%>  

Comments