Home Forums WinForms controls Xceed Grid for WinForms DataGridView.IsCurrentRowDirty equivalent?

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

    Does Xceed.Grid.DataRow and/or Xceed.Grid.InsertionRow have an equivalent to the DataGridView.IsCurrentRowDirty property?

    I want to ask the user if they want to commit edits only when changes have been made.

    Imported from legacy forums. Posted by Walter (had 951 views)

    User (Old forums)
    Member
    Post count: 23064

    Unfortunately, this does not exits, but it is possible to implement something that should do the trick.

    The InsertionRow kind of does that.  You can subscribe to the the EditEnded of the InsertionRow, because this is raised only when there is something modified in it, else it is the EditCanceled that is raised.

    For DataRow, EndEdit is always raised, so it is not usable as with the InsertionRow.  You could subscribe to the ValueChanged event on the DataRowTemplate cells, and to the EditCanceled and EditEnded events of the DataRowTemplate.  In the ValueChanged event handler, if you are still in edition mode, you can place in the Tag property a flag set to true (dirty).  In the EditCanceled, set the flag to false.  In the EditEnded, if the flag is true, then do the “dirty” stuff, if the flag is false, do nothing.

    On the side, certain data sources like DataTable and DataView have a built-in “dirtiness” feature.  If you are bound to such a source, at the EditEnded event, you could retrieve the DataRow in the source that corresponds to the row in the grid, verify its dirty flag, and do the corresponding action.

     

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

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