title: Merge multiple `<td>`'s in one `<tr>`. ASP.NET MVC3
body: <p>I have an ASP.NET MVC3 project.</p>
  
  <p>I want to insert some <code>&lt;td&gt;</code>'s in one table <code>&lt;tr&gt;</code>. These <code>&lt;td&gt;</code>'s contain one <code>&lt;div&gt;</code> each. These comes from a switch() which is in a partialView and renders into another View (where is the <code>&lt;tr&gt;</code> which could contain multiple <code>&lt;td&gt;</code>'s).</p>
  
  <p>This is the partialView:</p>
  
  <pre><code>@foreach (var item in Model)
  {
     switch (item.PitlaneId)
         {
             case 1:
                     &lt;td id=a&gt;
                         &lt;div class="drag"&gt;
                             Name: @Html.DisplayFor(modelItem =&gt; item.Name) &lt;br /&gt;
                             Constrainted: @Html.DisplayFor(modelItem =&gt; item.Constrainted) &lt;br /&gt;
                         &lt;/div&gt;
                     &lt;/td&gt;
             break;
  
             case 2:
                     &lt;td id=b&gt;
                         &lt;div class="drag"&gt;
                             Name: @Html.DisplayFor(modelItem =&gt; item.Name) &lt;br /&gt;
                             Constrainted: @Html.DisplayFor(modelItem =&gt; item.Constrainted) &lt;br /&gt;
                         &lt;/div&gt;
                     &lt;/td&gt;
             break;
  
             case 3:
                     &lt;td id=c&gt;
                         &lt;div class="drag"&gt;
                                Name: @Html.DisplayFor(modelItem =&gt; item.Name) &lt;br /&gt;
                                Constrainted: @Html.DisplayFor(modelItem =&gt; item.Constrainted) &lt;br /&gt;
                            &lt;/div&gt;
                     &lt;/td&gt;
             break;
  
             default: break;
         }
  }
  </code></pre>
  
  <p>And this partialView renders here:</p>
  
  <pre><code>&lt;table title="test" id="testTableID"&gt;
     &lt;colgroup&gt; @foreach (var item in Model){&lt;col width="300" /&gt;} &lt;/colgroup&gt;
     &lt;tbody&gt;
        &lt;tr&gt;
           @{Html.RenderAction("Tasks"); }  @* &lt;--- Here it renders*@
        &lt;/tr&gt;
     &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>The <strong>PROBLEM</strong> appears when switch() goes to the same case multiple times. If I have PitlaneId in this order: 1,2,2,3; It will create 4 <code>&lt;td&gt;</code>'s in my table. In this case I should have only 3 <code>&lt;td&gt;</code>'s and the two <code>&lt;div&gt;</code>'s with the same PitlaneId=2 should be inside the same <code>&lt;td&gt;</code>. <strong>I mean <code>&lt;td&gt;</code>'s with the same id should merge together.</strong> Same situation when PitlaneId comes in this order: 1,2,3,2.</p>