public void MergeCell(TableRow trow)
{
TableCell currentCell = trow.Cells[0];
TableCell prevCell = null;
for (var i = 0; i < trow.Cells.Count; i++)
{
currentCell = trow.Cells[i];
if (prevCell != null && currentCell.Text == prevCell.Text)
{
prevCell.ColumnSpan = (prevCell.ColumnSpan == 0 ? 1 : prevCell.ColumnSpan) + 1;
currentCell.Visible = false;
}
else
{
prevCell = currentCell;
}
}
}