I have a Datalist that displays 3 columns of data. The first column, however should only display for the first row of a group. My logic is not producing the desired result as nothing is displayed in the first column. Here is my code:
Code:
Public curCenter As String = ""
.
.
.
Public Sub dlItemDataBound(ByVal sender As Object, ByVal e As DataListItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim CenterLabel As Label
Select Case e.Item.ItemType
Case ListItemType.Item
CenterLabel = CType(e.Item.FindControl("lblCenter"), Label)
Case ListItemType.AlternatingItem
CenterLabel = CType(e.Item.FindControl("lblAltCenter"), Label)
End Select
If curCenter = CenterLabel.Text Then
CenterLabel.Visible = False
Else
'new Center
CenterLabel.Visible = True
End If
curCenter = CenterLabel.Text
End If
End Sub
I am at a loss to understand what's wrong. I welcome your comments.
- - - - - - - - - - - - - - - - - - - - - - -
In God we trust, everything else we test.