views:

224

answers:

1

I have a ListView that's bound to a LINQDatasource control and need to get the primary key value of the table within the ItemUpdated event handler.

I have no problem getting the value from within the ItemUpdating event handler because the ListViewUpdateEventArgs parameter provides access to the keys collection.

The keys collection does not seem to be available as part of the ListViewUpdateEventArgs parameter within the ItemUpdated event handler. I've also tried getting the value from the NewValues and OldValues collections but it is not available.

How should I be doing this?

The keys collection is available as part of the GridViewUpdateEventArgs after an update, why not the ListView?

+2  A: 

The ListViewUpdatedEventArgs object that's passed in to the ItemUpdated event handler for the ListView does not have a Keys collection like the GridViewUpdatedEventArgs object passed into the RowUpdated event handler for a GridView.

I ended up retrieving the key value for the updated item from the DataKeys collection using the EditIndex of the ListView.

ActivityListView.DataKeys[ActivityListView.EditIndex].Value
joshb