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

Tabbing within changed cell

Hello,

I've got a grid with a number of editable columns. Some of them are integer or double cells, and some are text cells.

When a user edits the contents of a cell and hits the TAB key, I want the grid to process and validate those changes and move to the next cell to the right (similar to the way that it handles an ENTER key press, although the enter key is configured to move to the next cell down).

Right now if the user makes a change in the cell and presses TAB it processes the change but stays inside the changed cell.

I'm guessing this would involve capturing a key press. What I'd like to do is capture the TAB key press, run a method that say 'this cell has changed, do whatever validation is necessary', then run a method that says 'Process the tab key press'.

Do those methods exist, or is there a simple flag somewhere that I can set?

Thanks!

Chris

3 Replies

AD Administrator Syncfusion Team March 2, 2007 06:12 PM UTC

Hi Chris,

Please refer to this KB article( What are the different validation events and event members? When are they triggered and how are they used? ) for more details on Validation of a cell. This will help you.

Best regards,
Haneef


CH Chris March 7, 2007 09:09 PM UTC

Hi Haneef,

Thanks for the link. The content was informative, but didn't seem to apply to my specific situation.

I'm trying to get the following behavior:

1) When a user clicks the 'tab' key within an unchanged cell, the current cell moves one cell to the right. If the current cell is the right-most cell,t he current cell should loop around to the first cell in the next row.
2) When the user clicks the 'tab' key with an edited cell, I want the CellValidating event to fire (which sends the updated value to the database), then the current cell should move one cell to the right. Again, if the cell is the right-most cell it should loop around the first cell in the next row.

I can't seem to get this behavior. Currently if the user presses the tab key without editing anything everything works as expected. The current cell moves and loops around to the next row just fine.

However if the user edits a cell and clicks the 'tab' key, the validating event fires and the validation happens, but the current cell remains current.

Any thoughts on how I can fix it?

Thanks,

Chris Rutledge



>Hi Chris,

Please refer to this KB article( What are the different validation events and event members? When are they triggered and how are they used? ) for more details on Validation of a cell. This will help you.

Best regards,
Haneef


AD Administrator Syncfusion Team March 7, 2007 10:13 PM UTC

Hi Chris,

Are you setting the e.Cancel to TRUE in your any one validating event like CurrentCellValidating? If yes, it locks current cell moving in a grid. You need to move the current cell after validating, you should set the e.Cancel to false.

Try setting the WrapCellBehavior property to true to move the first column next row cell in a grid while pressing the TAB key.

this.gridDataBoundGrid1.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow;

private void gridDataBoundGrid1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e)
{
MessageBox.Show("Validating Fired");
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon