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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

BindingList and ESC key

Thread ID:

Created:

Updated:

Platform:

Replies:

60851 May 14,2007 10:10 AM UTC May 14,2007 09:26 PM UTC WinForms 1
loading
Tags: GridControl
s
Asked On May 14, 2007 10:10 AM UTC

Hi,

we are using custom data binding in conjunction with the GGC. Our business object is derived from BindingList. Now when I click in a "append new row" cell and press a key, the AddNew method of the binding list is called and a new item is added to the list.

The problem occurs when I press ESC during this operation. I would expect, that the item is removed from the binding list because the add new row is canceled in the grid. But this is not the case - the item still exists in the binding list. I have attached a sample where you can see the behavior.

Cheers,
Steve

GGC_EscAndBindingList.zip

haneefm [Syncfusion]
Replied On May 14, 2007 09:26 PM UTC

Hi Steve,

You can handle the TableControlCurrentCellKeydown event and call RemoveAt method to remove the record at specified position in a list. Below is a code snippet

void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.KeyData == Keys.Escape)
{
Element el = e.TableControl.Table.CurrentElement;
if (el is GridAddNewRecord)
{
MyTable a = this.gridGroupingControl1.DataSource as MyTable;
a.RemoveAt(a.Count -1);

}
}
}

Here is a sample.
ModifiedGGC_ComboBox.zip

Best regards,
Haneef

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

;