Language

ListViewItemEventArgs Class

Definition

Provides data for the ItemCreated and ItemDataBound events.

public ref class ListViewItemEventArgs : EventArgs
public class ListViewItemEventArgs : EventArgs
type ListViewItemEventArgs = class
    inherit EventArgs
Public Class ListViewItemEventArgs
Inherits EventArgs
Inheritance
ListViewItemEventArgs

Examples

The following example shows how to use the ListViewItemEventArgs object to access the properties of the item that is being bound to data.


<%@ Page Language="C#" %>





    ListView ItemDataBound Example


    

ListView ItemDataBound Example

First Name Last Name Email Address

<%@ Page Language="VB" %>







    ListView ItemDataBound Example


    

ListView ItemDataBound Example

First Name Last Name Email Address

Remarks

Before the ListView control can be rendered, a ListViewItem object must be created for each item in the control. The ItemCreated event is raised every time that an item in the ListView control is created. This enables you to provide an event-handling method that performs a custom routine whenever an item is created, such as adding custom content to an item.

Similarly, before the ListView control can be rendered, every item in the control must be bound to a record in the data source. The ItemDataBound event is raised when an item (represented by a ListViewItem object) is bound to data in the ListView control. This enables you to perform a custom routine whenever an item is bound to data, such as modifying the values of the data before they are displayed.

A ListViewItemEventArgs object is passed to the event-handling method, which enables you to access the properties of the item that raised the event. To determine which item type (data item, empty item, or insert item) is being created, use the ItemType property of the ListViewItem object.

For a list of initial property values for an instance of ListViewItemEventArgs, see the ListViewItemEventArgs constructor.

Constructors

Name Description
ListViewItemEventArgs(ListViewItem)

Initializes a new instance of the ListViewItemEventArgs class.

Properties

Name Description
Item

Gets the item that is being created or bound to data.

Methods

Name Description
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also