I have a View as Follows
@model List<item>
@using (Html.BeginForm("Create", "Item", FormMethod.Post))
{
@for (int i = 0; i < Model.Count; i++)
{
.....
@Html.EditorFor(model => Model[i].ItemName)
.....
}
<input type="submit" class="btn btn-primary" value="Create Item" />
}
In the ViewModel this ItemName has a Required attribute annotation for Validation purposes, but what I really need is at least one ItemName to be filled to assume that this Model is valid, but I will always get The ModelState IsValid = False
I was able to solve this by using:
The validation works, but the validation is firing before POST