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
Child Refreshing
posted

I have a collection of BLPerson objects which I bind to a grid via a bindingsource as shown in the psuedo code below. The BLPerson object conatins a child which is a collection of BLUserid objects.

BLCollection<BLPerson> AllPeople = GetPeople();  /*go to db and get all people*/
bLPersonBindingSource.DataSource = AllPeople;
this.PersonGrid.DataSource=bLPersonBindingSource

when the User clicks on the "+" of the parent to  display the Userids, i do the following (in the BeforeRowExpanded) in an attempt to force the child data to be refreshed from the database. But the data is not refreshed. I know this because i have manually added a row to the database before expanding the parent and it doesn't show.

AllPeople = GetPeople()
this.bLPersonBindingSource.ResetBindings(false);
this.PersonUltraGrid.ActiveRow.Refresh(RefreshRow.ReloadData,true);

Can anyone explain what i should be doing to ensure that when a parent is expanded, the child data is retrieved from the db and displayed.

Thanks jv

 

 

 

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    The best way for this to work is if your data source sends a notification to the grid when the items is added. Does your collection class implement IBindingList?

    If that's not an option, then you need to force the grid to refresh. ResetBindings probably won't help and might even cause more problems.

    I would think that the Refresh method is the right way to go. I'm not sure why that doesn't work.

    You might try:

    this.PersonUltraGrid.Rows.Refresh(RefreshRow.ReloadData, true);

    or

    this.PersonUltraGrid.ActiveRow.ChildBands[0].Rows.Refresh(RefreshRow.ReloadData, true);

    If neither of those work, then I'm not sure why it's not working. The next step would be to try to reproduce the problem in a small sample project and either post it here or Submit an incident to Infragistics Developer Support so that we can take a look.

Children