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
90
UltrGrid DisplayLayout fails to pick settings for new columns on upgrade
posted

Hi,

 

We are using Infragistics version 9.2.

Scenario:

  1. MyWinApp v1.0, a hypothetical Windows application, contains an ultra grid with n columns.
  2. The ultra grid saves display layout every time user makes changes to the grid and loads that saved display layout and applies it to the grid when the grid loads.
  3. In MyWinApp v1.1, two new columns were added to the ultra grid.
  4. When a user upgrades from MyWinApp 1.0 to 1.1, the display layout saved from MyWinApp 1.0 doesn't contain the properties for the new columns. Therefore, those new columns would appear without correct formatting.

 Question:

Is there a way for the grid to pick up the formatting for the new columns when MyWinApp v1.0 is upgraded to v1.1?

Please feel free to ask any further questions to clarify this problem further.

TIA,

Okash

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Okash,

    I'm a tiny bit confused about what is happening in step 4. If you saved a layout in v1.0 of your application where the two new columns did not exist, and then you load that layout into a new version of your application where the two columns do exist, then what will happen is that those two columns will lose any property settings you may have applied to them. Since they don't exist in the layout, they will be reset to their default state.

    The only real way to get around that is to have a way, in your code, to set the properties on those two columns. In other words, don't set up the properties of these two columns at design-time, you will need to do it run-time.

    Once you do that, it leaves you with the problem of how to know if you should set the default settings on these two columns or not. You want to do this the first time the user loads the application, but you don't want to do it again after they have run MyWinApp 1.1 and saved a new layout.

    There are a couple of different ways you can go about detecting this. One way I've done it in the past is that I have saved extra information into the layout file. The Layout can be saved to a stream, so you could add in some extra information in the beginning of the stream that indicates the version of the application that the layout was saved with.

    Another alternative, which is a little easier to code, is to load the Layout into an UltraGridLayout variable instead of loading it into the grid directly. The idea is that you create an UltraGridLayout object and call it's Load method to load in the layout. Then you can examine the layout and see if the two new columns exist. Whether they exist or not, you use the grid.DisplayLayout.CopyFrom method to copy the loaded layout into the grid. Then you initialize the two new columns if needed - that is, if the two new columns did NOT exist in the layout.

Reply Children
No Data