Reputation: 9709
I have a MVC3 razor form where I use @Html.ValidationSummary(false)
It displays all errors including field errors at the top but it also displays field errors at field level. Is there a way to display at top only
thanks
Upvotes: 2
Views: 384
Reputation: 24526
You need to remove the Html.ValidationMessageFor(...) lines. These are the inline validation messages and are unrelated to ValidationSummary.
Edit: Making it optional:
@{var bool bInline = true;}
@Html.ValidationSummary(bInline)
@Html.LabelFor(m => m.MyField)
@Html.EditorFor(m => m.MyField)
@if (bInline)
{
@Html.ValidationMessageFor(m => m.MyField)
}
Upvotes: 1