I have a code that works fine to check if the next record is the same and if so then it removes it. my problem is when I try to do this for more than one column. can someone explain to me how this can be done and help me where i can fix the code.
Code:
If e.Row.RowType = DataControlRowType.DataRow Then
' Retrieve the underlying data item. In this example
' the underlying data item is a DataRowView object.
Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)
' Dim drv As DataRowView = DirectCast(e.Row.DataItem, DataRowView)
If previousCat = drv("FEDPROJECTNUM").ToString() Then
If gvaddenda.Rows(firstRow).Cells(1).RowSpan = 0 Then
gvaddenda.Rows(firstRow).Cells(1).RowSpan = 2
Else
gvaddenda.Rows(firstRow).Cells(1).RowSpan += 1
End If
e.Row.Cells.RemoveAt(1)
Else
e.Row.VerticalAlign = VerticalAlign.Top
previousCat = drv("FEDPROJECTNUM").ToString()
firstRow = e.Row.RowIndex
End If
End If
If e.Row.RowType = DataControlRowType.DataRow Then
' Retrieve the underlying data item. In this example
' the underlying data item is a DataRowView object.
Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)
' Dim drv As DataRowView = DirectCast(e.Row.DataItem, DataRowView)
If previousCat = drv("PROPOSAL_ID").ToString() Then
If gvaddenda.Rows(firstRow).Cells(2).RowSpan = 0 Then
gvaddenda.Rows(firstRow).Cells(2).RowSpan = 2
Else
gvaddenda.Rows(firstRow).Cells(2).RowSpan += 1
End If
e.Row.Cells.RemoveAt(2)
Else
e.Row.VerticalAlign = VerticalAlign.Top
previousCat = drv("PROPOSAL_ID").ToString()
firstRow = e.Row.RowIndex
End If
End If