List<string> errorsList = new List<string>();
foreach (ModelState modelState in ViewData.ModelState.Values)
{
foreach (ModelError error in modelState.Errors)
{
errorsList.Add(error.ErrorMessage);
}
}
foreach (var item in errorsList)
{
ModelState.AddModelError("", item);
}
No comments:
Post a Comment