Protected Sub OnDataBound(sender As Object, e As EventArgs)
For i As Integer = GridView1.Rows.Count - 1 To 1 Step -1
Dim row As GridViewRow = GridView1.Rows(i)
Dim previousRow As GridViewRow = GridView1.Rows(i - 1)
For j As Integer = 0 To row.Cells.Count - 1
If row.Cells(j).Text = previousRow.Cells(j).Text Then
If previousRow.Cells(j).RowSpan = 0 Then
If row.Cells(j).RowSpan = 0 Then
previousRow.Cells(j).RowSpan += 2
Else
previousRow.Cells(j).RowSpan = row.Cells(j).RowSpan + 1
End If
row.Cells(j).Visible = False
End If
End If
Next
Next
End Sub