hi,

We have developed a datagrid tied to a dataset (using batch update, where
all changes - multiple deletes, inserts, updates are done on the
disconnected dataset first). The problem we are facing is that we cannot
ensure that the item index of the grid is correctly mapped to the index of
the dataset.

A common scenario we face would be this: Say there are 5 rows in the
dataset initially. When it is first displayed to the user, both the dataset
and the datagrid have 5 rows.
Now, the second item on the datagrid is deleted. The result is that there
would only be 4 rows displayed to the user on the datagrid, while on the
dataset,there are still 5 rows in the dataset, but  the RowStateVersion for
the second row is now set to "Deleted".
Now say we add two new rows. The datagrid now has 6 rows, but the dataset
has 7.

If the user were to attempt to delete the 2nd row of the datagrid now, we
would find that the item index of the grid no longer matches the dataset
item. The row we are actually trying to delete is actually the third row in
the dataset. But since we get the index of the row to be deleted using the
DataGridEventArgs property e.Item.ItemIndex, the index of the second item
on the datagrid would be [1], and in the dataset, the index of [1] will
point to the row that was initially there but is now set to be deleted. So,
in effect we would be attempting to delete a row which has already been
deleted.

thanks,
subash

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to