Home Forums WinForms controls Xceed Grid for WinForms Howto insert a new row with InsertionRow

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


     another topic that keeps me puzzled is how to insert a new datarow in a databound grid. This should be trivial:

    Just insert the InsertionRow, fill in any values and the underlying datarow should be filled, when the EditEnded event is raised.

    Of course, it is not that easy, what happens is this:

    When I select the InsertionRow, a new empty DataRow is created. When leaving the InsertionRow, an EndEdit event is raised, the

    data row remains empty and no new row gets inserted.

    The documentation reads:

    How to make the InsertionRow insert its data

    As of version 1.1, the BeginEdit and EndEdit methods have been moved to the CellRow class rather than only the DataRow class meaning that you will only need to call the EndEdit
    method on the InsertionRow to commit the row.


    So this should be a no-brainer…but it remains a mystery to me.





    Imported from legacy forums. Posted by Dietmar (had 985 views)

    User (Old forums)
    Post count: 23064

    Okay, I figured out, that it is indeed as simple as stated in the documentation:

    The datatable update failed in my case, because the primary key datacolumn of the datatable was not configured properly

    (i.e. missing autoincrement settings), so that the new row being inserted by the insertionrow violated the primary key constraint

    of the datatable with the primary key column being null.

    Modifying the autoincrement properties of the datacolumn generated a valid primary key and the datatable update worked perfectly!



    Imported from legacy forums. Posted by Dietmar (had 977 views)

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