Ihave an UltraGrid which is populated form a collection of Custom objects where each object in the collection is a custom object called BLDepartment which itself contains properties of custom objects within it. The code to do this is:
this.AllDepartments = BLDepartment.GetDepartmentsFromManagerPersonId(BLPerson.LoggedOnPerson.PersonId);this.bLDepartmentBindingSource.DataSource = AllDepartments;this.bLDepartmentUltraGrid.DisplayLayout.LoadStyle = Infragistics.Win.UltraWinGrid.LoadStyle.LoadOnDemand;this.bLDepartmentUltraGrid.DisplayLayout.MaxBandDepth = 3;this.bLDepartmentUltraGrid.DataSource = this.bLDepartmentBindingSource;
The code hangs for a very long time (about 3 minutes) on the last line. I assume this is because as the grid is binding to the collection, it is going into evey public property of every BLDepartment object in the collection. If this is the case is there a way to stop this hapenning and so improve performance ?
Any help greatly appreaciated.
John
Hi John,
Band depth only controls the depth. It sounds like you have a root band with 3 child bands, and those 3 child bands have a total of 43 children of their own.
There's no way to remove a band from the grid. The only way to handle this would be to bind the grid to a DataSource that does not include those bands.
So maybe what you need here is to bind the grid to some sort of intermediary object instead of binding directly to your data source. You could use the UltraDataSource component, for example. Set it up with only the bands and columns that you want and then copy the changes to/from the UltraDataSource to the real data objects. You could also use the UltraDataSource in On-Demand mode. Check out the Virtual Mode Sample in the WinGrid or UltraDataSource samples.
Mike,Thanks for pointing me in the right direction. When I set MaxBandDepth=2 I see 4 bands when I look in the designer and performance is fine. When I set MaxBandDepth=3, which I need to do to get one of the bands I need, I see 47 bands in the designer and performance is bad.
I actually only need 1 parent and 2 child bands so is there some way to remove the unwanted 44 bands or stop them being read insome way ? Or only bind the 3 collection properties in my BLDepartment object that I need to the grid.
Thanks John
jvinnell said:I assume this is because as the grid is binding to the collection, it is going into evey public property of every BLDepartment object in the collection.
No, I don't think so. The grid doesn't do that. I will loop through all of the rows at the root level, but it's not going to access every property. My guess would be that your MaxBandDepth is somehow getting reset and the grid is, in fact, walking down beyond level 3. Try checking the MaxBandDepth property after you set the DataSource to see if it's still set to 3.
If that's not the issue, then I'll need more information. If you could post a small sample project demonstrating the issue, that would be the best thing and I could tell you exactly what's taking so long.
If not, then the structure of the BLDepartment would be helpful. Also, the number of rows in the list would be good to know.