fredv

fredv

  • NA
  • 1
  • 0

BindingContext position after deleting row

May 25 2005 6:56 PM
Hi, I've made a method that get the values of a row selected in a datagrid and then delete this row. This method uses the DataTable.delete() method and the bindingContext.position() If the selected row is the first row and I call this method : -The first row disapears from the datagrid and the second row become the first row (in the datagrid). The 'new' first row stay selected If I call this method again I've an error : can't access to informations of a deleted row. In fact, the first row has not been deleted from the dataset but its status property has been set to 'deleted'. Even if the selected first row in the datagrid is now the second row of the dataset, for the bindingContext the position is still 0. It seems that the databindingContext look at the selectedRow to return the position. The datagrid doesn't display the dataset rows with a status set to 'deleted' but this kind of rows are still numered in the dataset! For the datagrid bindingContext the position is 0, but the row 0 in the dataset is the deleted first row. In this case, how can I get the real corresponding position in dataset of a selected row in a datagrid ?? (at this point I don't want to acceptChange() in the dataset) Thanks