I have a set of radio buttons in my ASP.NET Core MVC view. If "Submit" (save) is clicked without selecting ALL radio buttons, I want to display a message:
All radio buttons must be selected
in the @HTML.ValidationSummary at the top of my view.
What's the best way to achieve this please?
One of the most simplest method is using
ViewBaginstead of@HTML.ValidationSummary.@HTML.ValidationSummarywill show all list of the error messages instead of custom error message by default, So you can try this simple demo:controller
Then, when you don't select all radio buttons and submit the form, The error message will show, You can also add
Cssstyle to make it look the way you want.