EditableRootLisBase, Infragistics Grid, and Canceling a New Row with the ESC key, Windows Forms

EditableRootLisBase, Infragistics Grid, and Canceling a New Row with the ESC key, Windows Forms

Old forum URL: forums.lhotka.net/forums/t/5227.aspx


JimStone posted on Monday, August 11, 2008

An interesting problem!

I have a ERLB Class (CSLA 3.5.1) bound to an Infragistics grid (v 7.3) on a Windows Form.

Canceling a new row (editable root in the ERLB) by pressing the ESC key twice removes all data added but does not remove the row from the grid  (the root item from the ERLB).  The row was added by entering data on the Add New row of the grid.

I have no explicit calls to BeginEdit, EndEdit, or CancelEdit anywhere - all is left to binding to handle.

To investigate, I did two things quickly.

1) I replaced the Infragistics grid with a MS DataGridView --- it worked fine.

2) I kept the Infragistics grid and replaced the RRLB object with a simple class inherited directly from System.ComponentModel.BindingList(of T) -- it worked fine.

So ERLB object worked fine with the MS grid, but not the Infragistics grid; but the Infragistics grid worked fine with a simple BindingList object.

Digging a little deeper, I found that the ERLB's CancelNew method (inherited from BindingList) WAS NOT firing when the ESC key was pressed twice on the Infragictics grid.  But it was from the MS grid.

But the Infragictics grid WAS firing the CancelNew method for the simple BindingList Object.

As a workaround, I "manually" invoked  ERLB.CancelNew(index) from the grid's AfterRowCancelUpdate event handler.  This causes the new row to be removed properly, but does not answer the basic question of WHY. 

Time permitting later, I may step through the Infragistics source code for a root cause.

If anyone has already experienced this and knows the real reason WHY, I would appreciate that info.

Also, if you know of a problem with the workaround I chose, I would appreciate that input also.

 

Copyright (c) Marimer LLC