Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
885
Header checkbox
posted

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.CheckBox
Me.grd.DisplayLayout.Bands(0).Header.CheckBoxSynchronization = HeaderCheckBoxSynchronization.RowsCollection
Me.grd.DisplayLayout.Bands(0).Header.CheckBoxVisibility = HeaderCheckBoxVisibility.Always

Thanks!

 
 

Parents
No Data
Reply
  • 6158
    Verified Answer
    Offline posted

    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

Children