Reputation: 1504
I am using the code from the below link. It works fine . But though there are validation errors, and ValidationSummary(true/false) is enabled, I am not able to see the validation message.
ASP.NET MVC Partial view ajax post?
As a work around ,When I try to display error message explicitly using the below code, it still does not display .When in debug mode, the ModelState has the error message , but it does not display .
<div>
@{
foreach (var i in ViewData.ModelState.Values)
{
<ol>
@{
if(i.Errors != null && i.Errors.Count>0)
{
var error = i.Errors[0];
<li>error.ErrorMessage</li>
}
}
</ol>
}
}
</div>
Please help.
Upvotes: 0
Views: 672
Reputation:
You can use @Html.ValidationMessage
html helper to display property-level validation message in your partial view.
Upvotes: 1