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
50
Ultragrid removes new child band of new parent band
posted

Hi, I've run into a problem with the ultragrid where the ultragrid is not properly displaying a newly added child band of a newly added parent. So for example lets say I have two collections of objects with a one to many relationship like countries and provinces. I bind the countries collection to the ultragrid, and I want to display provinces as the child bands. I'm using linq2sql datacontext to create all my datasources. so my databinding goes something like this.

//first I create a new context

contextDataContext sessionContext = new contextDataContext;

// I want to get a list of all the countries

var getAllCountries = from c in sessionContext.Countries select c;

// I bind my countries to a bindingSource

countriesBindingSource.datasource = getAllCountries

// and I set the datasource of my ultragrid to the countriesBindingSource.

 The grid works just fine for displaying all the existing countries and provinces, If I try adding a province to an existing country, it also works just fine for displaying the newly added province for that country. However, when I create a new country and add a province for that country, the grid will act really weird, first of all I can't refresh the grid to show the new province, second, if I close the form and re-open it when I click on the plus sign to expand the child band for the country I added the province to, it will expand and show the newly added province, but as soon as I click on that province the grid will hide the province. The underlying object collection is unaffected in any way so that if I itterate though my countries the newly added province is showing up and when I itterate for all the provinces the newly added province is also there and both object point to their respective selfs in the association. Also if I itterate through the grid's rows before I click on the newly added province (which causes the grid to hide it) the childband is present for the row of the newly added country, after the grid auto-hides my province, the childband for that same country is no longer present, so the grid removes the object from the band, but its not perpetuated in any way to the underlying collections. The only way I can coerce the grid into showing the new province is to re-instantiate the data context which is not an option for me cause I may have to re-read 1000s of records. I've tried using different versions of the ultragrid 7.3, 8.1 and 8.2 and run into this issue with all of them. I've also tried all various ways and combinations of adding the objects, adding them directly to the collections, adding them to the binding source, even using the add button on the grid and I consistently get the same behaviour of the grid hiding the province. I"ve been stuck on this for a while so any help is much appreciated.

Thanks,