The following example shows how to use the ItemType property to determine whether the item that is being created is a data item. If the item is a data item, the e-mail address is displayed in italic. This code example is part of a larger example provided for the ListViewItem class.
|
Protected Sub ContactsListView_ItemCreated(ByVal sender As Object, ByVal e As ListViewItemEventArgs)
' Retrieve the current item.
Dim item As ListViewItem = e.Item
' Verify if the item is a data item.
If item.ItemType = ListViewItemType.DataItem Then
' Get the EmailAddressLabel Label control in the item.
Dim EmailAddressLabel As Label = CType(item.FindControl("EmailAddressLabel"), Label)
' Display the e-mail address in italics.
EmailAddressLabel.Font.Italic = True
End If
End Sub
|
|
protected void ContactsListView_ItemCreated(object sender, ListViewItemEventArgs e)
{
// Retrieve the current item.
ListViewItem item = e.Item;
// Verify if the item is a data item.
if (item.ItemType == ListViewItemType.DataItem)
{
// Get the EmailAddressLabel Label control in the item.
Label EmailAddressLabel = (Label)item.FindControl("EmailAddressLabel");
// Display the e-mail address in italics.
EmailAddressLabel.Font.Italic = true;
}
}
|