Hi,
One of my grid columns having checkboxes and header checkbox allowing check/uncheck all.
For some reason when I am checking single checkbox in grid row header checkbox changing state to Indeterminate as well, anyway to prevent this?
I have following settings on this column:
Me.grd.DisplayLayout.Bands(0).Style = Infragistics.Win.UltraWinGrid.ColumnStyle.CheckBoxMe.grd.DisplayLayout.Bands(0).Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.RowsCollectionMe.grd.DisplayLayout.Bands(0).Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always
Thanks!
Hello,
When the HeaderCheckBoxSynchronization is set to Band or RowsCollection, the Cell values and header checkbox will always be kept synchronized. Therefore, changing the value of one of the affected cells, will change its header checkbox.
To achieve the desired results, you'll have to handle the synchronization yourself.
First you'll have to change the CheckBoxSynchronization of the appropriate column to HeaderCheckBoxSynchronization.None.
Me.grd.DisplayLayout.Bands(0).Columns(0).Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.None
Now you'll need to make sure the values of the cells are changed whenever the checkbox is clicked. This can be done by handling the AfterHeaderCheckStateChanged event, and setting the value for each row in e.Rows.
Private Sub grd_AfterHeaderCheckStateChanged(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterHeaderCheckStateChangedEventArgs) Handles grd.AfterHeaderCheckStateChanged Dim column As UltraGridColumn = e.Column Dim rows As RowsCollection = e.Rows Dim checkStateValue = column.GetHeaderCheckedState(rows) For Each row In rows row.Cells(column).Value = checkStateValue Next End Sub
This should help you achieve your desired functionality. Let me know if I can be of further assistance.
Thanks,
Chris
Hi Chris,
I followed your code and its working fine.. but the problem i am facing is when i check the header to true , all the rows are checked and vice versa.. but once i check the header true and manually uncheck any of the rows, it wont change the header to uncheck,
Please help me ... thanks in advance
Thanks, I will try let you know later if it is working. I am sure it is, since no more auto synch.