Hi,
Situation: I have a situation where the user is allowed to create rows in a grid and edit its content. There is also a button that allows the user to remove rows. This is done using the selectedItem from the grid.
Case: The user is editing a cell in a selected row, but then decides the row is no longer needed, and tries to delete the row (which is now in edit mode). The method which deletes the row then tries to get the selected row from that grid, but gets null back.
Proposed solution: So my question, is there a way that I can tell my grid to persist all pending edits in the grid, so the GetSelectedRow will not return null?
Kind regards,
Tobias
Hi Tobias,
It is not possible for a user to edit a cell in a selected row, or even to have any rows selected while editing. As soon as you enter edit mode on any cell, all selected rows are cleared.
So my best guess here is that the row you are editing is not selected, but is the Active row, so is appears selected. So what you could do is change your delete code so that if there are no selected rows (grid.Selected.Rows.Count == 0), you delete the ActiveRow instead.
Hi Mike,
I guess that'll do the trick.
Again.. thanks a lot!