When working with Repeaters I’m able to check and see if my ItemType in my ItemDataBound is an actual item by using the following code…
If e.Item.ItemType = UI.WebControls.ListItemType.Item Or e.Item.ItemType = UI.WebControls.ListItemType.AlternatingItem Then ...
How can I do this same thing with my ListView? I attempted the check the same way above but no luck. The If statement never gets executed.
Thanks!
EDIT
Private Sub ListView_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles ListView.ItemDataBound
If e.Item.ItemType = UI.WebControls.ListItemType.Item Or e.Item.ItemType = UI.WebControls.ListItemType.AlternatingItem Then
'This section never executes...
End If
Looks like you’re just using the wrong enumeration. Try the
ListItemViewTypeenumeration and that should solve your problem.