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
830
Populating Grid From Collection Of Custom Objects
posted

We have a custom BLPerson object which contains a number of child object such as BLUserid

We then do the following

BLCollection<BLPerson> ALLPeople=new BLCollection<BLPerson>
ALLPeople=BLPerson.GetAllPeople();
bLPersonBindingSource.DataSource =AllPeople;
blPersonUltraGrid.DisplayLayout.MaxBandDepth = 4;
this .blPersonUltraGrid.DataSource = this.bLPersonBindingSource;

Basically we have ALLPeople which is a collection of BLPerson which we bind to a grid.

We notice that when we trace into the line bLPersonBindingSource.DataSource =AllPeople; 
the code is going into each of the child objects for each of the BLPerson objects in the ALLPeople collection and populating this child object. This causes a significant performance.

We notice that if we comment out the bLPersonBindingSource.DataSource =AllPeople; line and set the grids datasource directly i.e this .blPersonUltraGrid.DataSource =ALLPeople then the problem doesn't ocurr however I have read that it is not good to set the datasource directly.

Any help on the best way to do this would be appreciated

Thanks John