ListView ItemDataBound - determine if an item is an AlternatingItem?
I am using Listview to display my data. In the ItemDatabound event, I want to do some manipulation and change some of the displayed data. When I check the Item on this event, I use the following code, but I need to know if the item is a variable, since that will affect what I want to do with that line. Can anyone point me in the right direction?
if (e.Item.ItemType == ListViewItemType.DataItem)
{
ListViewDataItem currentItem = (ListViewDataItem)e.Item;
DataKey currentDataKey = myLilstView.DataKeys[currentItem.DataItemIndex];
//Do something
}
+2
source to share