Hai...
I am working on a scenario in which, only updated rows need to be captured in order to update at the Backend.
In Detail - Ultragrid is loaded with values On Form Load to allow user to change values on the cells for the existing data. On Button Save , Only updated rows need to be saved. Is Any Default option Available to do the above?
Regards,
Janani Shivakumar,
Software Engineer.
Hi,
The grid does not track this. If you edit a row in the grid and move to another row, all changes in the previous row are committed to the data source.
The grid doesn't deal with the data base directly, it only deals with it's local data source. So if you are looking to track changes in the data source that need to be written to the database, then the data source needs to take care of that. The DataSet and DataTable class have built-in support for tracking pending changes.
The only thing you might have to be concerned about with the grid is that the current ActiveRow in the grid may have pending changes that need to be written to it's DataSource. For this you can use DataChanged. The grid will automatically commit changes when it loses focus, but if you need to manually force the changes to be committed, you can use the grid.UpdateData method, or the Update method on any individual row.
ok
Here i have to check whether ultragrid data had changed or not without considering to datasource..
that is grid have 10 rows with values ,when user edited few rows ,we have to find the edited rows only for update to
database
and if none of the rows were edited then no need to update database..
could you give me sample code for this?
UltraGridRow exposes a 'DataChanged' property, which returns true if the value of any cell in the row has been modified and the row has not yet been committed to the data source. Because this property is set back to false when the row is updated, which by default happens when a new row is activated or the grid loses focus, you would have to set the UpdateMode property to 'OnUpdate' and call the UpdateData method when you want to commit the user's changes.
Note that an alternative approach would be to handle AfterRowUpdate and maintain a cache of the rows that were updated, and use that cache to determin which rows have been modified.