MVC Client Validation from Service Layer
- by GibboK
I'm following this article
http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-a-service-layer-cs
to include a Service Layer with Business Logic in my MVC Web Application.
I'm able to pass messages from the Service Layer to the View Model in a Html.ValidationSummary using ModelState Class.
I perform basic validation logic on the View Model (using DataAnnotation attributes) and I have ClientValidation enabled by default which displaying the error message on every single field of my form.
The Business logic error message which come from the Service Layer are being displayed on Html.ValidationSummary only after Posting the form to the Server.
After Validation from the Service Layer I would like highlight one or more fields and have the message from the Service Layer showing on these fields instead that the Html.ValidationSummary. Any idea how to do it?
Thanks