title: How to validate list of items in a view in asp.net mvc
body: <p>I upload a file containing songs.I show the properties of each song.If i upload a file having 3 songs.the view shows like this.</p>
  
  <pre>
   music id:....                 music id:....                   music id:....
   song Name  :....              song Name  :....                 song Name  :....
   Music director :...           Music director :...             Music director :...
  
  </pre>
  
  <p>I have a view like this </p>
  
  <pre><code>@model List&lt;MusicBusinessLayer.Music&gt;
   @using (Html.BeginForm("Create", "Home", FormMethod.Post, new { }))
   {
  @Html.ValidationSummary(true)
  
  &lt;fieldset&gt;
      &lt;legend&gt;Music&lt;/legend&gt;
  
  
   @for (int i = 0; i &lt; Model.Count();i++ )
      {
  
      &lt;div style="float:left;"&gt;
       &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; Model[i].Music_Id)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.EditorFor(model =&gt; Model[i].Music_Id)
     @Html.ValidationMessageFor(model =&gt; Model[i].Music_Id)
     &lt;/div&gt;
  
      &lt;pre&gt;&lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; Model[i].Song_Name)
        &lt;/div&gt;
       &lt;div class="editor-field"&gt;
         @Html.EditorFor(model =&gt; Model[i].Song_Name)
       @Html.ValidationMessageFor(model =&gt; Model[i].Song_Name)
       &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
       @Html.LabelFor(model =&gt; Model[i].Music_Director)
       &lt;/div&gt;
        &lt;div class="editor-field"&gt;
        @Html.EditorFor(model =&gt; Model[i].Music_Director)
        @Html.ValidationMessageFor(model =&gt; Model[i].Music_Director)
         &lt;/div&gt;
    }
      &lt;p&gt;
          &lt;input type="submit" value="Create" /&gt;
      &lt;/p&gt;
  &lt;/fieldset&gt;
  
  }
  </code></pre>
  
  <p>I use controller like this</p>
  
  <pre><code> public ActionResult Create(List&lt;Music&gt; musicfiles)
      {
         //......
      }
  </code></pre>
  
  <p>How to validate controls which are generated in view.i.e;  All fields are given or not?</p>