Home Forums WinForms controls Xceed Grid for WinForms Updating only modified rows

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

    I want to update only the rows in my grid that have been modified. I am adding rows to a datarowlist collection on the after edited event, so each time a row is updated it is added to the collection. Then when a save button is clicked the collection’s rows are saved to the database and the collection is cleared. I was wondering if this is the correct way to implement this functionality or have I got it all wrong? Also how should a collection be setup? I have created a new grid with no data, which I assign to the collection. Any feedback would be appreciated.
     

    Imported from legacy forums. Posted by Frankie (had 966 views)

    Xceed Support
    Member
    Post count: 5658

    From what I understand, this seems like a good to know which rows have modified. However, if you use a DataSet as your data source, you can use the GetChanges() method to get the modified rows. And after saving, you call the AcceptChanges() method to “reset” the “changed flag” on the rows. You can set your DataSet as the DataSource of your GridControl (and the name of the DataTable as the DataMember).

    Imported from legacy forums. Posted by CharlesB (had 491 views)

    User (Old forums)
    Member
    Post count: 23064

    My situation is, I have an unbound grid which is populated from a dataset. When i first load the data into the grid I add an object (which i declare containing an ismodified flag) containing information about the row using the tag property of the row. Then on the afterupdate event I set the current rows tag object’s ismodified property to true. So when I save I check the rows that have had the property set to true and only update these rows.

    Does the solution outlined above work for both bound and unbound grids? I am new to using xceed grid, so thanks for the help.
     

    Imported from legacy forums. Posted by Frankie (had 657 views)

    Xceed Support
    Member
    Post count: 5658

    The above solution only applies if you are using a DataSet. So, it’s only for bound grid.

    Imported from legacy forums. Posted by CharlesB (had 976 views)

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