A validation summary is a Razor <div> that displays validation errors collected in ModelState. It complements property-level messages by giving users one place to find form-wide and field-specific problems. section 18.2.5 section 18.6
Apply the Validation Summary Tag Helper with asp-validation-summary:
- None displays no summary. section 18.2.5
- ModelOnly displays errors not associated with a specific property. section 18.2.5
- All displays both property errors and model-level errors. section 18.2.5
- Keep asp-validation-for spans near individual inputs when users need precise field feedback. section 18.2.5
Showing a model-level error
A currency-conversion form can add an error with ModelState.AddModelError(string.Empty, "Cannot convert currency to itself"). Returning the page when ModelState.IsValid is false lets a summary configured with All display that error, even though it belongs to the model rather than one input. section 18.2.5
<div asp-validation-summary="All"></div>
Use <div asp-validation-summary="All"></div> to render the summary as a list of ModelState errors. section 18.2.5


