Hi everyone,
I'm using header checkboxes in my ultragrid. A User is able to change the datasource of the grid, depending on what DataTable he wants to get displayed in the grid. Unfortunately, everytime I change the datasource back and forth, the state of the header checkboxes a datasource had before, is not saved. It has now the state of the last datasource which was bound to the grid. I read in another thread, that this is happening because the layout gets resetted everytime another datasource was bound to the grid.
Is it somehow possible to retain the state or can anyone suggest a workaround?
The header checkboxes represent the state of each of the cells in the associated column, so if that column is removed, as is the case when you assign a new data source, the header checkbox should and does reflect this change. If I understood everything, this sounds like correct behavior.
You could work around this by caching the cell values of the checkbox column before assigning the new data source, then matching them up to the new cells after the new data source is assigned. The header checkbox would then follow suit, since it "listens" for changes to those cells.
Hi,
I somehow managed to find a way around it. But I got a related problem now: If I call
band.Columns("Selected").SetHeaderCheckedState(ultraGrid1.Rows, CheckState.Indeterminate)
I get an Exception that says that Indeterminate is not supported. Is there a good reason for this I don't see? I really need to set it to Indeterminate at this point.
okay I found a workaround :-)
sort of ugly, but seems to work:
ultraGrid1.DisplayLayout.Override.HeaderCheckBoxSynchronization = HeaderCheckBoxSynchronization.None
ultraGrid1.DisplayLayout.Override.HeaderCheckBoxSynchronization = HeaderCheckBoxSynchronization.Default