Hi,
I'm using the CheckBoxOnHeader_CreationFilter class, which I found in the Knowledge Base, to get checkboxes on column headers:
this.ultraGrid1.CreationFilter = aCheckBoxOnHeader_CreationFilter;
I also want to use a header over tables to name them:
this.ultraGrid1.DisplayLayout.Bands[2].HeaderVisible = true;
If I use only one of those two things, there is no exception, but when I use both I get
a NullReferenceException by the time I expand the regarding table.
I get stopped at this line:
// Only put the checkbox into headers whose DataType is booleanif (aHeader.Column.DataType == typeof(bool))
aHeader.Column is null. Does anyone know how I can solve that problem so that I can fulfill both requirements (header AND checkboxes)?
Greetings,
Renelope
Hi Renelope,
If you update to the latest version of the grid, there is now built-in support for header checkboxes and you no longer need the creationfilter.
Hi Mike,
we updated to 10.2 now and I enhanced the code with:
band.Columns(0).Style = ColumnStyle.CheckBoxband.Columns(0).Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Alwaysband.Columns(0).Header.CheckBoxAlignment = HeaderCheckBoxAlignment.Default
That works fine, it checks/unchecks everything on the same hierarchical level.
Unfortunately I need some more logic behind that. Everytime this column of a row is checked, I called within the CellChange event method a specific method which does the logic I mentioned. When I now check all rows via this header checkbox, this event is not called and therefore my specific method neither. Do you know a way I can fix that problem?
Hello Renelope,
How often do you need this additional logic to run? Once for every cell that is changing or only once when the header checkbox is clicked?
If you need it to fire for each modified cell value, you can use the AfterCellUpdate event which should fire for each changed cell value. If you only need your additional logic to run once, you can use the AfterHeaderCheckStateChanged event.
Let me know if you require further assistance with this functionality.
Thanks,
Chris