title: how to prevent html input id duplication on asp.net mvc 3 when a model contains multiple elements
body: <p>I have a view that allows the user to inset multiple elements of the same type.  </p>
  
  <pre><code> @foreach (var gm in Model)
      {
          &lt;tr&gt;&lt;td&gt;
                  @Html.TextBoxFor(model =&gt; gm.name)
          &lt;/tr&gt;&lt;/td&gt;
      }
  </code></pre>
  
  <p>But, when I saw the generated HTML it is duplicating the id and the name</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;
          &lt;input id="gm_name" name="gm.name" type="text" value="" /&gt;
  &lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;
          &lt;input id="gm_name" name="gm.name" type="text" value="" /&gt;
  &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>Is there a way to automatically add an 1,2,3,etc and the end of id, example:</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;
              &lt;input id="gm_name1" name="gm.name1" type="text" value="" /&gt;
      &lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;
              &lt;input id="gm_name2" name="gm.name2" type="text" value="" /&gt;
      &lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>I can do that if I generate all the html, but, is there an automatically way to achieve that?</p>
  
  <p>Thanks</p>