We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Event on cell editor and Force Data Binding Refresh

I have 2 problems with the GridDataBoundGrid.

1st : In my application, when I press the F7 key, I want to call a specific piece of code. So far, I've simply added the call to the key-Up event of all the controls. It works fine except when I'm editing a row in the grid. I suppose the grid creates a Textfield for me to type in and that field does not have the event. In Java, using a JTable, I was able to change the default "cell editor" to add the event. How can I do this in a GridDataBoundGrid?

2nd : When editing a cell, the changes are "commited" back to the data-source only when the focus exits the row. Is there a way to FORCE this update without exiting the row?? From Java again, there was a function called "grid.IsEditing" and "grid.EndEditing"... I'm looking for something similar. It's related to the F7 key too... When I hit F7, I want the DataSource to be updated and editing to end.

Thanks!


2 Replies

PM Philippe Marseille August 22, 2008 01:22 PM UTC

Ok

I've found a solution for problem #1. grid.CurrentCell.IsEditing and grid.CurrentCell.EndEdit();

Still trying to catch a key_up event when editing a cell... the KeyPressed event on the current cell (CurrentCell_Key-Pressed) works ok for charaters but not for F7 keys, I need the KeyUp event...



PM Philippe Marseille August 26, 2008 02:33 PM UTC

Finally found the solution by myself.

To catch events on the cell editor

GridTextBoxCellRenderer tbr = (GridTextBoxCellRenderer)grid.CellRenderers["TextBox"];

tbr.TextBox.KeyUp += new KeyEventHandler(Handler_KeyUp);


And finally, to force an update of the data (reverse of the refresh): grid.CommitChanges();



Loader.
Live Chat Icon For mobile
Up arrow icon