So I know how to return any value using the CurrentRow. Let's say a user has one row selected, and they right-click on a different row, I need to retrieve the value from that row. I've been looking at CurrentRowChanging & Changed as I suspect I need to capture the value there. I think my issue is the value being returned now is the value from the previously selected row and I'm not aware of the event trigger hierarchy.
Any help? Thanks
4 Answers, 1 is accepted
Thank you for writing.
You can use the MouseClick or the CellClick event:
Let me know if you have additional questions.
I haven't had any luck with this and I may have failed in explaining myself better.
We have a custom context menu, and when that context menu is rendered it is supposed to pick up a value from a particular column on the selected row. As it is right now, it is picking up the value previously selected when the user right clicks on a different row. I need to pick up the new value from a column on the new row, the row the user right-clicked on.
It works if the user first left-clicks to select the row, then right-clicks. But if all they do is right click on another arbitrary row, it's picking up the previous value.
Update: I've tried capturing the value I need in the CurrentRowChanged (past tense right?), but in debug mode I can visually see the event fire before the new row is in fact changed.
Is the only reliable means to left click one, then right click?
Thank you for writing back.
In this case, it would be better to use the ContextMenuOpening event to retrieve the cell value. The following snippet shows how you can get the value in the item Click event handler:
I hope this helps.