asp.net mvc - asp-validation-summary shows custom but not model errors -
asp-validation-summary in view shows errors added via modelstate.addmodelerror, don't show model validation errors ("the user field required."). i'm using microsoft.aspnetcore.mvc 1.0.0-rc2-final. btw: user field not displayed via view correctly identified ef model level error before add.
//<div asp-validation-summary="modelonly" class="text-danger"></div> in view modelstate.addmodelerror(string.empty, "this error shows in validation-summary"); viewbag.headermessage = "error: " + string.join(" - ", modelstate.values.selectmany(x => x.errors).select(x => x.errormessage));
errors show in field filled via viewbag not in validation-summary
change html:
<div asp-validation-summary="modelonly" class="text-danger"></div>
to
<div asp-validation-summary="all" class="text-danger"></div>
Comments
Post a Comment