Hi,
How do you get selected data from DataGrid after it has been sorted?
I have a DataGrid bound to a DataTable. When a user clicks on one of the rows, my program will get the row index (using DataGrid.CurrentRowIndex property) from the DataGrid, use the index to retrieve the appropriate row from the DataTable, and continue processing the retrieved data. This works fine, except after users click on the column header to sort the DataGrid. After the DataGrid is sorted by columns, apparently the index returned by the DataGrid does not matched with the index on the DataTable. Hence, my program is unable to get the proper data.
Any idea how to solve the problem?
Thanks.
Henry
How do you get selected data from DataGrid after it has been sorted?
I have a DataGrid bound to a DataTable. When a user clicks on one of the rows, my program will get the row index (using DataGrid.CurrentRowIndex property) from the DataGrid, use the index to retrieve the appropriate row from the DataTable, and continue processing the retrieved data. This works fine, except after users click on the column header to sort the DataGrid. After the DataGrid is sorted by columns, apparently the index returned by the DataGrid does not matched with the index on the DataTable. Hence, my program is unable to get the proper data.
Any idea how to solve the problem?
Thanks.
Henry