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
close icon

Problem with your IBindingList Sample

Hi,

we have a problem with your IBindingList sample which comes with the new Syncfusion version 5.

I have attached the modified sample so you can see the issue. The problem occurs during the add new row mechanism.

So when you start the sample place the cursor in the "Add New" row and press a key. A new item is added to the list automatically via the AddNew method of the IBindingList interface. Now when you press "ESC" the item added before will be deleted via the RemoveAt method of the IList part.

Now place the cursor in a cell of the row above the "Add New" row with the mouse. And then back to the "Add New" row. Press a key and the same procedure as before occurs (A new item is added to the list via the AddNew method). Now when you press ESC nothing happens - no call of RemoveAt. And this is the problem. So the list grows internally but the grid displays only some items.

Why is RemoveAt only called in the first time? Any ideas?

Cheers,
Markus

IBindingListSample.zip

1 Reply

HA haneefm Syncfusion Team May 15, 2007 05:31 PM UTC

Hi Markus,

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)
{
e.Inner.Handled = true;
DataCollection a = this.gridGroupingControl1.DataSource as DataCollection;
a.RemoveAt(a.Count -1);
}
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon