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?
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