My users want to change column order, column width, etc. in an UltraWinGrid based on a selection from a combobox and to automatically restore those changes whenever the click on that selection. I've been reading up on savelayout/loadlayout but is there a way to save the layout in a SQL Server table?
JamesJay
Hi,
You can save the layout to either binary or XML and to a file or a stream. So one thing you could do is save the layout to a text Stream as XML and then store that xml in a database.
HOWTO:How can I save a stream to a database?
Mike, thanks for the code sample. It worked great except...when I save and load the PropertyCategories I lose summary for one of my grids. It disappears and we really need the total it previously displayed. Have you ever heard of this or have a suggestion? JamesJay
No, I can't see why that would be. Maybe something in your code is removing the summary after you load the layout. Or perhaps the PropertyCategories you are specifying does not include summaries?
Where can I get more information on what the different PropertyCategories do? I'm having a lot of trouble now with the format changing in the columns like losing currency and noedit properties. When I disable the object that loads the saved properties the defaults are restored.
I know the previous programmer wasn't aware of PropertyCategories because he saved the individual column widths in a table and loaded them back in a column at a time. An unwieldy process which I tried to improve using PropertyCategories. In hindsight maybe not the right thing to do.
Is there anything other than directly setting categories in the code that could accidentally set/reset them?
Well, other than the help, I don't know of any other documentation on what the categories include. Why specify categories at all? Why not just save everything? Is there something specific that you want to exclude from the saved layout?
There are any number of ways that you could reset or change a property setting. Loading the layout just sets certain properties, so anything in your code could change those settings after the layout is loaded. You could check for the word "Reset" in your code, I guess.
Ok, now I'm really getting confused.
The only thing I find in help for PropertyCategories is that it's an enum. I don't understand why you would have a choice of property categories if you don't know what each one does or is for. How can I use them if I don't know what they do?
I tried using PropertyCategorie.All but I lost my Summary row when the DisplayLayout was loaded. There has only been one other developer on this project and he didn't do anything with DisplayLayout that should affect the summary row when the DisplayLayout is loaded. I have not done any manipulating of DisplayLayout either.
I have also gotten some strange behavior from loading PropertyCategories like columns previously set to NoEdit getting changed to AllowEdit and columns hidden property being changed from True to False.
All I am trying to do, all I need to do is save the grid's column widths and column order for a user and restore them when the user opens trhe application. I wanted the definitions for the PropertyCategories to see if I could limit changes to just col width and order and, hopfully, not lose the summary row when the categories are loaded.
Hi James,
JamesJay said:The only thing I find in help for PropertyCategories is that it's an enum. I don't understand why you would have a choice of property categories if you don't know what each one does or is for. How can I use them if I don't know what they do?
They are documented here:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Infragistics2.Win.UltraWinGrid.v8.2~Infragistics.Win.UltraWinGrid.PropertyCategories.html
JamesJay said: I tried using PropertyCategorie.All but I lost my Summary row when the DisplayLayout was loaded. There has only been one other developer on this project and he didn't do anything with DisplayLayout that should affect the summary row when the DisplayLayout is loaded. I have not done any manipulating of DisplayLayout either.
If you specified All, then everything should be saved, including the summaries. Assuming you specified All when you both saved and loaded the layout, then I can't explain why the summary row is lost. It should not be. Either something in your code is removing it somehow or there's a bug there.
Perhaps you should Submit an incident to Infragistics Developer Support and include a small sample project demonstrating the behavior you are getting so they can take a look.
kordeneaux said:It seems even using "All" doesn't capture which columns are shown/hidden.
The All category most certainly does include the hidden property on the column. If that's not working for you, then something else in your application is blowing away those settings.
I'm writing the documentation team now. I have wasted far too much time trying to figure out which PropertyCategory to use.
It seems even using "All" doesn't capture which columns are shown/hidden.
By the way, Mike, I should mention that many of the problems I'm experiencing with the grid right now have more to do with the code written by the previous programmer that the UltraWinGrid control. I'm finding out that he knew very little about the power of the grid control and apparently wasn't interested in finding out. One example, to show currency he would hard code a dollar sign into the query rather than setting the Format property to'C'.
I am slowly fixing this code so hopfully my app can start cooperting with the grid instead of fighting with it.
Thanks for your quick response to all my questions.
James
Well, I agree that those descriptions aren't very helpful. There's a link at the bottom of the help topic page where you can write to the documentation team and comment about the page. :)
Mike,
The problem with missing summary row was my. I wasn't saving the original default settings so they were overwritten by a version that didn't have a summary row. My fault, (which I'm kind of releaved about. I really needed that summary row).
The documentation for the PropertyCategories Enum, well that's not much help. I mean, the nuns at St. Robert's School taught me to never use the word in writing the definition for that word. "AppearanceCollection: Serialize Appearance Collection" is not helpful at all. It says nothing more than the category itself.
But now that I know what I was doing wrong it shouldn't matter if I'm saving all or not so I think I'm ok.
Thanks for your imput.
JameJay