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

BindingList and ESC key

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

1 Reply

HA haneefm Syncfusion Team 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

Loader.
Live Chat Icon For mobile
Up arrow icon