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
130
UltraGrid Columns Resetting
posted

We're using UltraGrids quite extensively throughout our application. They're all bound to datasources and are used to view data only, the adding/editing goes on elsewhere.

Randomly (or what seems to be randomly) the grids will lose column settings (their hidden property and header caption) but the other properties will remain saved (autofitstyle/override properties etc.)

I've tried a number of things in the code in an attempt to stop this happening, like only setting the data source as the array if the array has data, using the SetDataBinding instead of DataSource, with and without the DataBind() method.

The same is happening with the UltraCombos.

Can anybody help please?

Thanks

Paul

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Paul,

    That's quite a puzzle. The grid will throw away it's DisplayLayout under certain circumstances, like when the DataSource is changed or the DataSource sends a Reset notification to the grid.

    But I've never heard of the grid losing some settings and not others. My best guess is that this is something in your code which is either resetting those properties specifically, or else the DisplayLayout is getting thrown out and your code is re-applying most, but not all, of the settings.

    I would advise you to take a look at the InitializeLayout event of the grid. If you are handling this event, then it will get called any time the data source gets reset. So if your code is setting the properties that are NOT getting lost, that might explain why.

    You might also want to search your code to see if you are ever calling the Load method(s) on the grid's DisplayLayout.

    FYI, there is never any reason I've been able to find to call the DataBind method on the grid (or any Windows Forms control) since setting the DataSource or DataMember implcitly binds.

    As a general rule, you should always use the SetDataBinding method and never explicitly set the DataSource or DataMember properties, and never call the DataBind method.

     

     

Children