Hi
I have a datagrid bound to a list. One of my columns is a valuelist. I have created a save button where I iterate my changed rows, however the column with the value list even after a change the DataChanged value shows false and the OriginalValue contains my new value, so I cannot seem to detect whether the user has changed the value or not. It seems to be OK on cells that are tickboxes only on the valuelist cells.
Am I missing something obvious?
Thank you!
Dave
Hi Dave,
DataChanged in the grid means that the grid has changes that have not been saved to the data source. That's the local data source, not neccessarily the database at the back end. The grid only works with the local data source.
So typically, once you leave the cell, the change in the grid is committed to the data source and so the grid's DataChanged is false.
If you need to keep track of changes made to the data source so that you can update the back end, that would be something the data source itself should do. DataTable / DataSet does this, for example.
Hello Mike
Thanks for your help. The problem I have is my list is bound to a System.Collections.Generic.List, this object as far as I can see does not have a way for me to track changes? Is there a way to stop the grid updating the datasource when you leave the cell or ideally row?
As I am struggling to see the uses of the DataChanged property, also my checkbox row does work when I check to see if the DataChanged flag has changed when I iterate, so does this type of column (it is still bound to a column in my datasource) function differently.
Sorry if I am being a little dense.
Thanks for the info. I will convert it to datatables in that case. All very annoying as I am using LINQ, but that's life I suppose!
bigdavelamb said:Thanks for your help. The problem I have is my list is bound to a System.Collections.Generic.List, this object as far as I can see does not have a way for me to track changes?
That's correct, it does not.
bigdavelamb said:Is there a way to stop the grid updating the datasource when you leave the cell or ideally row?
This is a tricky one. I'm actually not sure if this is possible. There's a discussion about this that you might want to check out here: UltraGrid.UpdateMode and BindingList<T> data source - Infragistics Community
bigdavelamb said:As I am struggling to see the uses of the DataChanged property, also my checkbox row does work when I check to see if the DataChanged flag has changed when I iterate, so does this type of column (it is still bound to a column in my datasource) function differently.
I can't see how that could possibly work or why a checkbox cell would be different than any other cell. There's a slight difference in that the CheckBox doesn't show a separate control when it enters edit mode, but I don't see how that would matter here. Maybe if you click on one checkbox without moving off the cell or the row, it would show as changed, but once you leave the row, it has to update the data source.