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
410
Child rows are not displaying
posted

I have a ultrawingrid on a form bound to a collection of business objects.  The business object has a child collection that is also displayed in the grid as a child band.  I am updating the child collection in the beforerowexpanded event.  When new items are added to the object however, the grid does not display them.  I have stepped through the code in the debugger and the e.Row.ListObject given shows the correct elements, the grid just doesn't display them.

 Has anyone else seen this issue and have a possible workaround?  I have even tried calling the DataBind method on the grid and it still does not display the new data.  Note that when I remove all items from the collection, the grid does reflect the changes, but if I add or remove items (leaving at least one) it does not.

Parents
  • 95
    posted

    I have exactly the same problem...

    My grid is bounded to a BindingSource filled with a list of entities... those entities have sub-lists that are displayed in child bands..

    I have implemented drag&drop to be able to drop objects over the list so they are added to the list... Here is the OnDragDrop :

        Protected Overrides Sub OnDragDrop(ByVal drgevent As System.Windows.Forms.DragEventArgs)
            MyBase.OnDragDrop(drgevent)
            If Me.ObjetoDragValido(drgevent) Then
                Dim oRowsDestino As IList = Me.ObtenerRowsDestino(drgevent)
                If (oRowsDestino IsNot Nothing AndAlso oRowsDestino.Count > 0) Then
                    Dim oRows As SelectedRowsCollection = TryCast(drgevent.Data.GetData(GetType(SelectedRowsCollection)), SelectedRowsCollection)
                    Dim oList As New List(Of Object)
                    If oRows IsNot Nothing Then
                        For Each o In oRows
                            oList.Add(o.ListObject)
                        Next
                    End If
                    For Each oDestino As UltraGridRow In oRowsDestino
                        If (TypeOf oDestino Is UltraGridRow _
                                 AndAlso TypeOf oDestino.ListObject Is IDragDrop) Then

                            CType(oDestino.ListObject, IDragDrop).DoDrop(oList)
                            Dim o As Object = oDestino.ListObject
                            oDestino.Activate()
                            oDestino.Expanded = True
                        End If
                    Next
                End If
            End If
        End Sub.

    The DoDrop call does add some objects (the dropped ones) to the list included in the entity of the row (ListObject).

    After lots of testing I've found the following:

    If I drop objects on a collapsed row.. they get added and on expand they show...
    If once the row is expanded I drop some more, they don't appear (even when the entity's list in watch window shows the new ones)
    If the row is expanded but there are no child rows... it works, I drop some and they show....

    Well, the behavior is really weird... I don't find a method to "reload" the child rows from one given row... is that possible? What am I doing wrong?

    I've already tried to refresh the grid, using .DataBind(), using row.Update(), row.Refresh() ... they all have the same behavior...

    I need help for this, please!!

     

Reply Children