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.
Unfortunately, activation email could not send to your email. Please try again.

Event on cell editor and Force Data Binding Refresh

Thread ID:

Created:

Updated:

Platform:

Replies:

76091 Aug 21,2008 05:25 PM Aug 26,2008 10:33 AM Windows Forms 2
loading
Tags: GridControl
Philippe Marseille
Asked On August 21, 2008 05:25 PM

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!


Philippe Marseille
Replied On August 22, 2008 09:22 AM

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...


Philippe Marseille
Replied On August 26, 2008 10:33 AM

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();



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;