Why can't I retrieve deleted DevExpress Grid rows?
I'm trying to get a list of rows deleted by pressing the '-' button in a Devexpress Grid widget as depicted here. Howe开发者_运维百科ver, doing the following does not return any results
DataView delrows = new DataView(myTableAdapter.DataView.Table);
delrows.RowStateFilter = DataViewRowState.Deleted;
What am I doing wrong?
edit: Filtering on Added and Modified rows works fine.
instead of doing as you do now try this:
myTableAdapter.DataView.RowStateFilter = DataViewRowState.Deleted;
of course it's not easy to guess without knowing better your data binding architecture...
Considering that your DevExpress grid is binded to a DataTable (either with or without a DataView):
You can retrieve the deleted rows by using the Select()
method of the DataTable
. This is not a linq method.
table.Select(null, null, DataViewRowState.Deleted);
The rest of the rows can be retrieved by using
table.Select(null, null, DataViewRowState.CurrentRows);
Just be aware that a row that is added then deleted will not have the deleted flag, but will instead be removed from the rows collection. Such rows would also have a RowState
of Detached
.
精彩评论