Hi,
I'm having an unusual problem with an ultra grid which I'm hoping has been seen before ... despite a search being unable to find anything.
I'm binding my grid to a data object (lets call it ParentObject) which has a property of List<ChildObject>. I've added a few unbound columns to the Child Object as these are then used to populate hidden fields of the Child Object. Everything seems to work OK until I attempt to resolve what should be in my unbound fields.
During the initialisation, after setting the populated data source I step through each row in each band and attempt to cast the row as either ParentObject or ChildObject depending on which band is being iterated through. My issue is that when iterating through the rows of the ChildObject band, the rows returned are in actual fact the rows within the ParentObject band!
Has anyone seen this happening before or got any suggestions?
~Daniel
Matt,
I had been walking throught the rows using a foreach within the constructor (foreach Band -> foreach Row). As you suggested I moved the population code to the InitializeRow event and this now works.
The bizarre thing is though that I'd copied this method from several other UltraGrids where the same approach has been used successfully for populating unbounds. Oh well, I'll look to convert all the population to the InitializeRow for consistency and robustness.
Thanks
Daniel,
How are you walking through the rows? The ideal place to initialize unbound columns is to use the InitializeRow event, since this will fire when a cell value changes so that you can update the other cells if necessary, as well as do things like change appearances.
-Matt