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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16229 |

    Hi,

     I’m having problems with the insertion row blanking when none of the initialized values in the insertion row have been changed.

    I pared it down to the most basic case:

     1. I create a TableAdapter within a DataSet which creates a table with only 1 column of type int.

     2. I hook this up to a binding source.

    3. I create a GridControl, hook it up to the binding source, and add an insertion row.

    4. In the GridInitializingNewDataRow event handler I use the following code:

     e.DataRow.Cells[colPersonnelId.Index].Value = 60001;

    5. I run the application and double click the insertion row. The value populates correctly.

    6. HOWEVER if I hit enter now to complete the insertion the row is not inserted and the insertion row is blanked.

    7. I hooked up the other grid events to see what was happening and EditCancelled appears to be called on the insertion row even though ValidationError is not called ( which is what I would expect if there has been a problem ).

    8.NOTE: This is without any other processing. I am not trying to do anything other than add the row to the grid.

     Is this a bug or am I missing something.

    Any help would be greatly appreciated.

     
    Cheers

    Mansy

     

    Imported from legacy forums. Posted by Mansy (had 593 views)

    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)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.