Is there anything that might prevent the SaveAsXml method from saving the band and column settings?
I'm calling the method at a point after InitializeLayout has run. For some grids, the SaveAsXml method saves all of the column data (position, size, etc). For some others, the exported XML file doesn't contain references to the BandsCollection, ColumnsCollection, or SortedColumnsCollection.
For the problem grid, the DataSource is bound at design time and the grid displays everything correctly when run. I tried both SaveAsXml(character) and SaveAsXml(character,PropertyCategories.All). In both cases, one grid I'm testing exports correctly, the other doesn't.
I checked at the point I'm calling the export and the grid has a bands collection (1 band) and the band has 17 columns. I've attached the two XML files. Any help would be greatly appreciated.
Regards,
Jim
Hi Jim,
I can't think of anything that would cause the grid to fail to save the layout. My guess would be that the grid didn't have any bands or columns at the time you called the Save method, but you already checked that.
Is it possible that some other place in your code is overwriting the same save file at some other point when the grid does not have bands or columns?
Can you duplicate this in a small sample project?
Thanks Mike,
The XML files I sent were copied immediately after the SaveAsXml method call. I created an empty temp file, called the SaveAsXml and then paused the program to get a snapshot of the xml file. Also, the temp file is created using a GUID so it's guaranteed to be unique.
I can try to create a sample, but the sample will not have the same level of complexity as the actual app. My thoughts are that it will work fine but I'll let you know.
Is there some other property I can test when the SaveAsXml call is made that could possibly show what's going on? I've already checked that the DataSource property is set, the DisplayLayout.Bands.Count is non-zero (1 in this case), and that the Bands.Items[0].Columns.Count is non zero.
Thanks,
So it seems like it's simply a question of referencing the grid control too early? I'm not sure I see how that could be the issue, though. Because you would have to set the DataSource and DataMember on the grid before you load the layout, anyway.So you would have had to reference the grid, anyway.
To further complicate matters, there is a known bug right now in v9.1 and up that sometimes causes the loading of the layout not to work correctly, so you might be running into that issue, as well. The issue will be fixed in the next service release.
If you want to try to duplicate the issue in a small sample project and post it here, I can run it with the latest internal build just to check and see if the issue is, in fact, fixed.
Hi Mike,
I also experience a bug in v9.1.
Rearranging, sorting etc does work. But if I do a group-by a column then there is an error.
Example Data:
a,b,ca,d,eb,f,gGroupBy First Column gives me two groups: group a and group b:
a,b,ca,d,e------- separator -----b,f,gHowever after a save and reload, I get three groups: group a, group a and group b, each with one item:
a,b,c------- separator ----- a,d,e------- separator ----- b,f,gIs this the same bug as in v9.1.? How I can track the content of the already reported bug and when it will be available?
Best regards,
Reto
Hi Reto,
It's impossible for me to guess if this is the same issue, but it sounds like it might be. The best thing for you to do is get the latest service release and see if it fixes the issue. I suspect it will.
If not, we can certainly look into it.
where can I get information about the latest service release?
My Infragistics Keys and Downloads - Download Anything and Everything You Own
thanks for the sample project. I finally found the reason for the behaviour.
I use DataBinding with a BindingList. Then on the UltraGridColumn, the GroupByMode was not set (therefore set to Default). This worked fine if I load the grid with the data and manipulate it, e.g. do grouping. But when call SaveAsXml and LoadAsXml (and no GroupByMode set), then the grouping does not work correctly anymore after LoadAsXml was called. It may have do to something with the bound object types tough.
If I set the GroupByMode to Text, then it always works, so I am going to use that.
Regards,Reto
I just tested this out and it's working fine for me. I am attaching the sample project I used here so you can try it out.
Just run the sample, drag any column into the GroupByBox, then press the buttons in order from top top bottom to save, reset, and then re-load the layout.
I have installed the latest service release and it does not fix it. E.g. my version is:Infragistics2.Win.UltraWinGrid.v9.1\9.1.20091.2039
If I have a grid, then group by a column and do a SaveAsXML and immediately reload the output using LoadAsXML, the grouping is destroyed.
Can you please have a look at this?