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

GDBG simulate ESC click (Delete a row which is not saved yet)

Thread ID:

Created:

Updated:

Platform:

Replies:

23471 Jan 13,2005 07:26 AM UTC Jan 13,2005 01:03 PM UTC Windows Forms 1
loading
Tags: GridControl
Gil Kalo
Asked On January 13, 2005 07:26 AM UTC

Hi, I need GDBG support the following behaviour: Add new row to grid, while editing the new row, I want to remove the row. In this situation, when clicking cancel button, the new row is removed. this is OK. How can I simulate the ESC button click in code? I tried, binder.CancelEdit, grid.DeleteRowAtRowIndex, grid.CancelUpdate, but none of these has been worked. Any ideas? Thanks, GilK

Administrator [Syncfusion]
Replied On January 13, 2005 01:03 PM UTC

Are you using teh AddNewRow at the bottom of the grid to let your user add the new row? If so, the default behavior is for the first esc to cancel the currentcell changes, and then the second esc cancels the row changes(if any), and if this is the AddNew row, it will remove it. If your user is in the middle of editing the AddNew row, pressing esc twice will delete it. You could try simulating this by: SendKeys.Send("{ESC}"); SendKeys.Send("{ESC}"); This should work as long as the grid has not lost focus. SO, having a menu item or toolbar button to trigger this is OK, but if it is Button on a form that triggers this, you woul dhave to set button1.CauseValidation = false to avoid thr grid losing focus when you click the button to trigget the action. If this does not work then I thing woul dwoul dhave to call grid.CurrentCell.EndEdit, grid.Binder.EndEdit and then grid.Binder.RemoveRecords. This would finish adding the record so it could then be removed. There are also DataTable.RejectChanges and DataRow.RejectChanges that can be used to do this as well.

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.

Warning Icon 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.Close Icon

;