asp.net.ph

DataView.ListChanged Event

System.Data Namespace   DataView Class


Occurs when the list managed by the DataView changes.

[ VB ]
Overridable Public Event ListChanged As ListChangedEventHandler

[ C# ]
public virtual event ListChangedEventHandler ListChanged;

[ C++ ]
public: virtual __event ListChangedEventHandler* ListChanged;

In [ JScript ], you can handle the events defined by a class, but you cannot define your own.

Event Data

The event handler receives a ListChangedEventArgs containing data related to the ListChanged event. The following ListChangedEventArgs properties provide information specific to this event.

Property Description
ListChangedType Gets the way that the list changed.
NewIndex Gets the new index of the item in the list.
OldIndex Gets the old index of the item in the list.

Remarks

For more information about handling events, see Web Forms Events and Handlers.

Example

The following example illustrates how to programmatically add a handler for the ListChanged event of a DataView.

void CreateDataView ( DataTable dt ) {
   DataView dv = new DataView ( dt, "", "ContactName", DataViewRowState.CurrentRows );
   dv.ListChanged  += new System.ComponentModel.ListChangedEventHandler 
      ( OnListChanged );
}

protected void OnListChanged ( object src, 
      System.ComponentModel.ListChangedEventArgs args ) {
   Response.Write ( "ListChanged:" );
   Response.Write ( "\t    Type = " + args.ListChangedType );
   Response.Write ( "\tOldIndex = " + args.OldIndex );
   Response.Write ( "\tNewIndex = " + args.NewIndex );
}
  C# VB

See Also

DataView Members Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note