I got many [Required] fields in my model.
And, in traditional MVC way, I will add @Html.ValidationMessageFor() for each required textbox.
Then, if user doesn’t type anything for 5 textboxes, 5 message will show up in the UI.
My question is: can I show just one message saying Please fill mandatory fields in the UI instead of showing the message everywhere like Name is required, Address is required…?
and I need this to be validate on Client Side, without post form back to server
You might want to look at
ValidationSummary– http://msdn.microsoft.com/en-us/library/system.web.mvc.html.validationextensions.validationsummary(v=vs.108).aspx – Returns an unordered list (ul element) of validation messages that are in the ModelStateDictionary object. You can override the message like so:Source https://stackoverflow.com/a/4924494/201648