Hi,
I have a strange error that I don't understand. Please view the attached text file for error details.
I have a grid with one column of (mostly) checkboxes. Note these ultracheckbox controls were set manually because the column's data in inconsistent (some cells are blank or contain text). Everything is bound to a manually filled ultradatasource. So far everything works fine.
When a checkbox is checked the SubObjectPropChanged event is caught and used to update the data in the model. The model contains logic to update other data it contains (simple example: checking one checkbox also checks all relevant checkboxes in child objects). These updates need to be reflected in the grid again.
First this was done by replacing all rows in the ultradatasource (it cannot be known how much data has changed so everything need to be updated): This worked ok, but we lost the row expansion state (makes sense because the rows were removed and recreated).
Second solution was to leave the rows in place and set all the cell values (overwriting the old values but maintaining everything else in the grid). This kept the expansion state as desired and updated the rows as desired. All seemed well if not for this one error. It is (occasionally) thrown on this line:
modelCell.SetValue(gridCell.EditorResolved.Value);
I read the editors value and not the cells value because the event seems to be thrown before the cell has been updated; not much of an issue. However at some point (this line is part of a loop) I get this strange error and I don't know why.
Maybe some1 can shed some light on it?
ty,Teun
P.S. Swallowing the exception would "solve" the issue and the code would work as expected but obviously I don't want to do that.
It lloks like there is a bug on the CheckEditor whereby the Value property getter is not throwing an exception when the editor is in not edit mode, so execution proceeds until the GetDataFilteredDestinationValue throws an exception because the 'owner' parameter is null.
For your purposes, this bug is not really the cause of the problem because one way or the other you will get an exception. I'm afraid I was not able to follow exactly what you are trying to accomplish here, but the line of code that is calling UltraGridCell.SetValue would have to change, because you cannot access the editor's Value property unless the cell is in edit mode.
Hi Brian,
Well that confuses me a bit because it works just fine when you swallow this exception. The cell is getting set correctly.
I am uncertain about what the definition of edit mode is, but the cell is not disabled or anything. The user can interact with the checkboxes, so why wouldn't the code be able to?
Although your theory fits with the error showing when replacing the value of a cell it leaves me wondering: If I am doing something wrong, why does it work? Maybe more importantly, how do I do it correctly?
-EDIT 1-
Ok I had another look at the code with a colleague. The things we don't get are:
We also had a look at programmatically setting the control in edit mode when wanted to read its value (even though that doesn't seem to make sense), but this proved excessively complicated. Many parameters were required which we were unable to supply on short notice.
-EDIT 2-
I had a look at this thread: http://community.infragistics.com/forums/t/13965.aspx But setting the Edit mode as seen there didn't solve my problem (at all).
Surely it's possible to simply update the Grid's data programmatically... let alone read it's data. Please help me out here.
grtz,Teun