Validation summary in MVC3, combining predefined and ModelState errors
I'm having problems understanding how to best implement unobtrusive client side validation that works together with errors added in the controller with ModelState.AddModelError().

So, this is the current code:

    @Html.ValidationSummary(true)
    @Html.ValidationMessageFor(model => model.FirstName)
    @Html.ValidationMessageFor(model => model.LastName)

The error message will correctly appear if I'm leaving out firstname. If I enter a firstname and tab out, the message will disapear - as it should work.

When no client error exists and I can submit this form, I have to do a check against the database that the user doesn't already exists. If it does, I'm adding an error with: 

    ModelState.AddModelError("", "User already exists")

When returning the model, an error box is shown, but there is no message in there.

If i change @Html.ValidationSummary(true) to @Html.ValidationSummary(false) I will see the error message correctly returned with the model. But then all client validation will be duplicated and shown in two different places.

Also, I would like the errors to show up in the same div if it's possible. As it is now, it will be two different validation summary div's with the false parameter.

Any way around this?
Validation summary in MVC3, combining predefined and ModelState errors
===

I'm having problems understanding how to best implement unobtrusive client side validation that works together with errors added in the controller with ModelState.AddModelError().

So, this is the current code:

    @Html.ValidationSummary(true)
    @Html.ValidationMessageFor(model => model.FirstName)
    @Html.ValidationMessageFor(model => model.LastName)

The error message will correctly appear if I'm leaving out firstname. If I enter a firstname and tab out, the message will disapear - as it should work.

When no client error exists and I can submit this form, I have to do a check against the database that the user doesn't already exists. If it does, I'm adding an error with: 

    ModelState.AddModelError("", "User already exists")

When returning the model, an error box is shown, but there is no message in there.

If i change @Html.ValidationSummary(true) to @Html.ValidationSummary(false) I will see the error message correctly returned with the model. But then all client validation will be duplicated and shown in two different places.

Also, I would like the errors to show up in the same div if it's possible. As it is now, it will be two different validation summary div's with the false parameter.

Any way around this?