Home Forums WinForms controls Xceed Grid for WinForms Detail grid data loading time? Reply To: Detail grid data loading time?

User (Old forums)
Post count: 23064

We identified the problem and found a solution.

What happens is that, even though the detail grids rows are not created as long as they are not expanded, the grid still binds to the data (that is, DataRow.Cells(“Relation”).Value ).  This forces the DataView of the relation to be created for every master row/ detail grid, that is, for every master row, a new DataView with only the corresponding data is generated.  You can see that this is time consuming…  and we can’t control that, this is how .NET binding works.

Now, we can delay this DataView creation to the time the actual detail grid is expended.  To accomplish that, the DataSource and DataMember must not be set on the template detail grids, but rather at the CollapsedChanged event.

For example :

  Private Sub BinTestDetailColapsedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim LocalDetail As Xceed.Grid.DetailGrid = Nothing

    LocalDetail = DirectCast(sender, Xceed.Grid.DetailGrid)
    If Not LocalDetail.Collapsed Then

      If LocalDetail.Title.Contains(“Best”) Then
        LocalDetail.SetDataBinding( LocalDetail.ParentDataRow.Cells(“MasterBin_DetailBin”).Value, Nothing)
        LocalDetail.SetDataBinding( LocalDetail.ParentDataRow.Cells(“MasterBin_SubDetailBin”).Value, Nothing)
      End If
    End If

Imported from legacy forums. Posted by André (had 578 views)