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
1125
UltraGrid Layout getting reset at runtime
posted

Hi there

I have a problem with Ultragrid whereby it's losing the column layouts I set at design-time when the app is run.  I'm getting this in several places in my app and it seems to occur at random, the grids are working fine, then they just lose their settings, even when that part of the app hasn't been worked on.

I've had a good read through what's been posted previously on this, and I understand that this is probably due to the runtime datasource not matching what was set at design-time.  I can't really understand how this would be the case as the full column list displayed at design-time matches up the columns shown at runtime.

My questions are;

  1. How do I check that this is the case  - i.e. what's the bet way to debug this.  I take it the grid doesn't throw an exception to say the datasource didn't match up with the layout?
  2. What are the possible causes of this - how does the grid decide whether the datasource has changed?  Is it just looking for matching field names and datatypes or is there more to it than that?
  3. What's the best practice for setting up the bindingsources for grids?  Currently I have a bindingsource for the form which has a child list property that is displayed in the grid.  The grid is bound to a second bindingsouce which has its datasource set the form's datasource and the datamember set to the child list property.  At runtime all I do is then set the parent bindingsource's datasource to an instance of the class.  Does that sound right?

E.g. 

Parent object is a CustomerClass, and CustomerClass has a child collection of CustomerClass.OrdersList.

The form is bound to the CustomerBindingSource, which has a datasource of CustomerClass

the grid on the form is bound to a OrdersBindingSource, which has a datasource of CustomerClass and a datamember of "OrdersList".

 

Any help in getting to the bottom of this would be much appreciated, it is driving me nuts!