Home Forums WinForms controls Xceed Grid for WinForms Bug with InsertionRow blanking unchanged initialized insertion row values. Reply To: Bug with InsertionRow blanking unchanged initialized insertion row values.

User (Old forums)
Member
Post count: 23064

This is not a bug.  It is by design, for developers who don’t want to add the row if no values are added/modified in the row.

The workaround is to use the EditBegun event on the InsertionRow instead of the InitializingNewDataRow event on the GridControl.  In the event handler, set the cell’s value, which will flag the row to “dirty”, which will add it when leaving the edit mode.

e.g. :

      private void Form1_Load( object sender, EventArgs e )
      {
        insertionRow1.EditBegun += new EventHandler( insertionRow1_EditBegun );
      }

      private void insertionRow1_EditBegun( object sender, EventArgs e )
      {
        ( ( InsertionCell )( ( InsertionRow )sender ).Cells[ 0 ] ).Value = “Example initial value”;
      }

Imported from legacy forums. Posted by André (had 993 views)