Hello all,
I got the problem: load grid layout from an XML layout file throws exception.
Situation:
The windows application (OS WindowsXP) with UltraGrid (Infragistics 2008 Vol. 1)
User can move columns or set columns unvisible.. so far so well.
then the user favorite layout can be save as one XML File -
This XML document can be saved as string in one table column in oracle database, which has datatype as CLOB.
Next time if the user use the application, we get the string from database and store in an XML document.
Then in WindowsForm LoadEvent use this -
this
But I could not see any bands in the grid, the grid is empty. (Without the "LoadFromXML" all is fine.)
It seems that the XML file corrupt?
or is the layout file dependent on database table column type or database parameters?
or perhaps I should use this method in the Grid InitializeLayout Event?
Many thanks in advance & best wishes
Hi, Mike,
yes, something is wrong, I found the error: because I used methods in the wrong order.
In WindowsForms LoadEvent I used the following methods:
1. Binding DataSource to Grid.
2. After step 1. the Grid goes in the InitializeEvent ...
(In these Event I defined one ColumnFilter programmatically, in order to get filtered data rows!)
3. Finally I used the method LoadGridLayout from XML file.
But the step 2 pointed out a mistake - the step 3 overwrote the ColumnFilter, so I could not see any rows after Step 3, because FilterCondition mismatched!
The correct order should be:
3. Use method LoadGridLayout from XML for column position and visibility.
4. At the end to set ColumnFilter to Grid, to filter data rows and it works fine.
Thanks for your helps & regards
I'm afraid I do not understand what you mean. The flags I listed here include everything except the filters applied to a column.
If the Hidden property of a column is not being saved, then something is wrong. I tested out this code before I posted it and it worked fine for me.
thanks for your answer! but the test failed.
If I use - PropertyCategories.All & ~PropertyCategories.ColumnFilters
then the column visibility can not be saved.
Actualliy I want to save all properties without this:
<a1:FilterCondition id="ref-121" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/Infragistics.Win.UltraWinGrid/Infragistics2.Win.UltraWinGrid.v8.1">
<ComparisionOperator>0</ComparisionOperator> <CompareValue xsi:type="a2:ObjectWrapper" xmlns:a2="http://schemas.microsoft.com/clr/nsassem/Infragistics.Shared.Serialization/Infragistics2.Shared.v8.1">
<objectValue xsi:type="xsd:decimal">100000000000</objectValue> </CompareValue> </a1:FilterCondition> (In the case I have used Column Filter : ID=100000000000)
PropertyCategories is a flagged enumeration. So you can combine values.
If you want to save everything but the filters, you could do this:
this.ultraGrid1.DisplayLayout.SaveAsXml("file.xml", PropertyCategories.All & ~PropertyCategories.ColumnFilters);
I found the problem - SaveAsXML saves also filtercondition!
I used SaveAsXML("file.xml", UltraWinGrid.PropertyCategories.All)
So if I only want to save the column position or column visibility of each bands,
which PropertyCategory should I use?
Many thanks & best wishes.