title: Merging cell of equal value in ASP.NET Repeater
body: <p>Currently I try to use Repeater WebControl in order to display a table that list out all possible component. Below is my table;</p>
  
  <p><a href="https://i.stack.imgur.com/HdcJX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HdcJX.png" alt="enter image description here"></a></p>
  
  <p>Right now I try to merged cells in Group Code and Group Description column that have the same value. Below is my merging cell code, noted that the code is in class;</p>
  
  <pre><code>public void repeaterRowSpan(string repeaterID, string columnID)
  {
      var pageHandler = HttpContext.Current.CurrentHandler;
      Control ctrl = ((Page)pageHandler).Master.FindControl("ContentPlaceHolder3").FindControl(repeaterID);
      Repeater repeaterName = (Repeater)ctrl;
  
      for (int i = repeaterName.Items.Count - 1; i &gt; 0; i--)
      {
          HtmlTableCell oCell_previous = (HtmlTableCell)repeaterName.Items[i - 1].FindControl(columnID);
          HtmlTableCell oCell = (HtmlTableCell)repeaterName.Items[i].FindControl(columnID);
  
          oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan;
          oCell_previous.RowSpan = (oCell_previous.RowSpan == -1) ? 1 : oCell_previous.RowSpan;
  
          if (oCell.InnerText == oCell_previous.InnerText)
          {
              oCell.InnerText = "";
              oCell_previous.RowSpan += oCell.RowSpan;
          }
      }
  }
  </code></pre>
  
  <p>Somehow the code manage to delete the same value in the column but maintain the rowspan. When I debugged, the oCell_previous.RowSpan return '2' so the code itself working fine. Below is the result of merging;</p>
  
  <p><a href="https://i.stack.imgur.com/mtOQ1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mtOQ1.png" alt="enter image description here"></a></p>
  
  <p>How can I modified my code in such way it will merged the cell?</p>
  
  <p>In your opinion, between Repeater and GridView which is most suitable to show data in table form in this project? In my understanding, Repeater is most suitable since it faster than GridView. GridView is only suitable if you have edit function to go with your table.</p>