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
15
Display UltraGrid selected Checkbox row only
posted

Hi Team,

I am using ultragrid control with checkbox and We provided radio button for applying a filter for the showing "selected checkbox row" or "all row".For Filter, we wrote following VB.NET code. We use Grid with row header checkbox and Grid Header checkbox.

So ModifyGridRowsShown called by two thread.

1.UI Thread(Main Thread).

2.Background Thread.

Problem: When I call this function with UI Thread its work fine but when I called This from Background Thread its throw exception "Index Out of Bound" and display RED X.

This exception occurs sometime not regularly and I am not able to catch this exception on TRY...Catch block as well as on UltrGrid.Error event.

Public Overrides Sub ModifyGridRowsShown(ByVal filter As Boolean)
            
            If Me.grdResult.Rows.Count > 0 Then
                Dim row As UltraGridRow = Nothing
                For Each row In grdResult.Rows
                    If Not Nothing Is row.ChildBands Then
                        ' Loop throgh each of the child bands.
                        Dim childBand As UltraGridChildBand = Nothing
                        For Each childBand In row.ChildBands
                            Dim i As Integer
                            For i = 0 To childBand.Rows.Count - 1
                                If filter Then
                                    If Not DirectCast(childBand.Rows(i).Cells(0).Value, Boolean) Then
                                        childBand.Rows(i).Hidden = True
                                    End If
                                Else
                                    childBand.Rows(i).Hidden = False
                                End If
                            Next
                        Next
                    End If

                    If Not filter Then
                        row.Hidden = False
                        row.ExpandAll()
                    End If
                Next
            End If
        End Sub