title: ASP.NET View IEnumerable Item validation
body: <p>I have this ASP:NET MVC Razor View which has a IEnumerable as model .</p>
  
  <p>I'm creating a table where each line represents a item from the IEnumerable.</p>
  
  <p>I'm using this code:</p>
  
  <pre><code>@foreach (var item in Model)
  {
      &lt;tr&gt;
          &lt;td&gt;
              &lt;input type="checkbox" name="selectedFoo" value="@item.isAdded"
                 @(Html.Raw(item.isAdded? "checked=\"checked\"" : "")) /&gt;
              @item.FooName
          &lt;/td&gt;
  
          &lt;td&gt;
              @Html.EditorFor(modelItem=&gt; item.Name, new { htmlAttributes = new { @class = "form-control", style = "width: 70px" } })
              @Html.ValidationMessageFor(modelItem=&gt; item.Name, "", new { @class = "text-danger" })
  
          &lt;/td&gt;
  
       &lt;/tr&gt;
  }
  </code></pre>
  
  <p>My problem is that when I enter an incorrect value for the "Name" property all the other text input get the validation error.</p>
  
  <p>Solutions?</p>
  
  <p>Thank you.</p>