for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--)
{
GridViewRow row = gridView.Rows[rowIndex];
GridViewRow previousRow = gridView.Rows[rowIndex + 1];
for (int i = 0; i < row.Cells.Count; i++)
//for (int i = 0; i < cnt; i++)
{
string rowcell = row.Cells[i].Text;
string previousRowCell = previousRow.Cells[i].Text;
if (row.Cells[i].Text == previousRow.Cells[i].Text && i==11)
{
// int j = i + 1;
row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1;
previousRow.Cells[i].Visible = false;
}
}
}