i think these two steps are enough
1. Remove the Html.ValidationMessageFor()
2. Add Html.ValidationSummary(false, "Your custom summary message") inside using(html.BeginForm()
Question
I want to group my ValidationMessageFor at the top of the page instead of after each edit/textbox.
Is it possible to do something like this or is there any other way to achieve my idea?
@Html.Partial("_PartialView", MyModel)
@model MyModel
@foreach (var item in Model)
{
@Html.ValidationMessageFor(item)
}
Instead of doing this:
@Html.ValidationMessageFor(model => model.Foo)
@Html.ValidationMessageFor(model => model.Bar)
@Html.ValidationMessageFor(model => model.etc..
Solution 2
i think these two steps are enough
1. Remove the Html.ValidationMessageFor()
2. Add Html.ValidationSummary(false, "Your custom summary message") inside using(html.BeginForm()
OTHER TIPS
I think you might be looking for
@Html.ValidationSummary()