-
I use ValidationSummary(true) to print model validation errors in
one place and property validation errors near each field. -
In the controller i add a property error : ModelState.AddError(“property”,”error”)
I see the message validation error for that property but i also got the validation-summary-errors div although i have no model error.
What am i doing wrong and why is that div generated if i have no model errors?<div class="validation-summary-errors"> <ul> <li style="display:none"></li> </ul> </div>
I use ValidationSummary(true) to print model validation errors in one place and property validation
Share
You will have to add it twice like so:
Or you can change your call like so:
Changing the argument to
falsewill include all Property errors. The param name inValidationSummaryisexcludePropertyErrors, so by passingtrueyou are excluding them.