Hi,
We have created a class to draw the checkbox on the header of the grid at runtime using the creation filter and also code for selecting and deselecting all the rows in the grid on click of the header checkbox. We want to change the checked state at runtime without clicking on the header check box.
Is there any way to change the state of the check box without clicking on the header column / CheckBox?
We are attaching the Creation filter class for your reference.
Changing the value isn't going to make the event fire. It's not suposed to. Events exist to tell you when the user does something - so it will only fire when the user actually clicks on the checkbox.
If you are changing the value of the checkbox in code, then you know you did it and you don't need an event to tell you so. What you should do is move the code in the event handler into a method and then call the method from the event and also call the same method whenever you set the value yourself.
HI Mike,
We did the following changes in the code :
UlGrid1.DisplayLayout.Bands(0).Columns(
0).Header.Tag = 1
UlGrid1.DisplayLayout.UIElement.DirtyChildElements()
It did change the state of the header check box, but the "HeaderCheckBoxClicked" event was not fired, we tried Re-Assigning the Creation filter to the grid as follows:
UlGrid1.CreationFilter = aCheckBoxOnHeader_CreationFilter_CostType
Can you please tell are we missing anything, how do we call the "HeaderCheckBoxClicked" event explicitly ?
First, in case you didn't know, we added header checkboxes to the grid in v9.1. So if you upgrade it would save you a lot of coding. :)
It looks like this CreationFilter is the one from our KnowledgeBase. It stores the state of the CheckBox in the colmun header's Tag property. So to change the checkbox value, all you have to do is change the Tag on the column header and force the grid to refresh the UIElements and re-fire the creationfilter. You do that by calling grid.DisplayLayout.UIElement.DirtyChildElements() and the CreationFilter will be called again the next time the grid paints.