Hello!
I've created module to save and restore RadGridView look do database. After reorder or resize column, application save string as xml file with grid properties/settings.
There is ReadStream method:
public static void ReadStream(Telerik.Windows.Controls.RadGridView dg, string nameInDB)
{
System.IO.Stream stream;
(...read stream from database)
stream = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(rdr.GetString(rdr.GetOrdinal("stream"))));
Telerik.Windows.Persistence.PersistenceManager manager = new Telerik.Windows.Persistence.PersistenceManager();
manager.Load(dg, stream);
stream = null;
}
Problem is that sometimes (after I have no idea what happened) I got error:
Source type must be an enumerable type, which closing my application.
Im pretty sure it's about ReadStream, becouse when I clear 'stream' in database everything work's great.
Any idead how can I solve this? ;)
Not sure if it help, but there is code (stream) I have in database:
<?xml version="1.0"?> <RawData
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SerializationString><?xml version="1.0"
encoding="utf-16"?> <Data
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<T> <TI K="102606522"
N="Telerik.Windows.Controls.RadGridView,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
<TI K="-664072138" N="System.String, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<TI K="883639814" N="System.Int32, mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<TI K="-1932319100" N="Telerik.Windows.Controls.GridViewLength,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
<TI K="15099789"
N="Telerik.Windows.Controls.GridView.GridViewLengthConverter,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7" />
<TI K="-2019819835" N="polcom.Additions.ColumnProxy, VisionPOS,
Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null"
/> <TI K="-1544587235"
N="System.Collections.Generic.List`1[[polcom.Additions.ColumnProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" /> <TI
K="-880364446"
N="System.Collections.Generic.List`1[[polcom.Additions.SortDescriptorProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" /> <TI
K="-213719500"
N="System.Collections.Generic.List`1[[polcom.Additions.GroupDescriptorProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" /> <TI
K="-1313846753"
N="System.Collections.Generic.List`1[[polcom.Additions.FilterSetting,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" /> </T>
<P> <PV Key="1"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">kod</Value>
</PV> <PV Key="2"
TypeKey="883639814"> <Value
xsi:type="xsd:int">0</Value>
</PV> <PV Key="3"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Kod</Value>
</PV> <PV Key="4"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Auto</Value>
</PV> <PV Key="5"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">ilosc</Value>
</PV> <PV Key="6"
TypeKey="883639814"> <Value
xsi:type="xsd:int">2</Value>
</PV> <PV Key="7"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Stan magazynowy</Value>
</PV> <PV Key="8"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">nazwa</Value>
</PV> <PV Key="9"
TypeKey="883639814"> <Value
xsi:type="xsd:int">3</Value>
</PV> <PV Key="10"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Nazwa POS</Value>
</PV> <PV Key="11"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">nazwa2</Value>
</PV> <PV Key="12"
TypeKey="883639814"> <Value
xsi:type="xsd:int">4</Value>
</PV> <PV Key="13"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Nazwa paragon</Value>
</PV> <PV Key="14"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">cena</Value>
</PV> <PV Key="15"
TypeKey="883639814"> <Value
xsi:type="xsd:int">5</Value>
</PV> <PV Key="16"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Cena netto</Value>
</PV> <PV Key="17"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">cena2</Value>
</PV> <PV Key="18"
TypeKey="883639814"> <Value
xsi:type="xsd:int">1</Value>
</PV> <PV Key="19"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Cena brutto</Value>
</PV> <PV Key="20"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">vat</Value>
</PV> <PV Key="21"
TypeKey="883639814"> <Value
xsi:type="xsd:int">6</Value>
</PV> <PV Key="22"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">VAT</Value>
</PV> <PV Key="23"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">jMiary</Value>
</PV> <PV Key="24"
TypeKey="883639814"> <Value
xsi:type="xsd:int">7</Value>
</PV> <PV Key="25"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Jednostka miary</Value>
</PV> <PV Key="26"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">grupa</Value>
</PV> <PV Key="27"
TypeKey="883639814"> <Value
xsi:type="xsd:int">8</Value>
</PV> <PV Key="28"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Grupa towarowa</Value>
</PV> <PV Key="29"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">czyProdukt</Value>
</PV> <PV Key="30"
TypeKey="883639814"> <Value
xsi:type="xsd:int">9</Value>
</PV> <PV Key="31"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Produkt?</Value>
</PV> <PV Key="32"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">czyPolprodukt</Value>
</PV> <PV Key="33"
TypeKey="883639814"> <Value
xsi:type="xsd:int">10</Value>
</PV> <PV Key="34"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Półprodukt?</Value>
</PV> <PV Key="35"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">czySurowiec</Value>
</PV> <PV Key="36"
TypeKey="883639814"> <Value
xsi:type="xsd:int">11</Value>
</PV> <PV Key="37"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">Surowiec?</Value>
</PV> <PV Key="38"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">categoryID</Value>
</PV> <PV Key="39"
TypeKey="883639814"> <Value
xsi:type="xsd:int">12</Value>
</PV> <PV Key="40"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">idProduktu</Value>
</PV> <PV Key="41"
TypeKey="883639814"> <Value
xsi:type="xsd:int">13</Value>
</PV> <PV Key="42"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">nazwa3</Value>
</PV> <PV Key="43"
TypeKey="883639814"> <Value
xsi:type="xsd:int">14</Value>
</PV> <PV Key="44"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">nazwa4</Value>
</PV> <PV Key="45"
TypeKey="883639814"> <Value
xsi:type="xsd:int">15</Value>
</PV> <PV Key="46"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">opis</Value>
</PV> <PV Key="47"
TypeKey="883639814"> <Value
xsi:type="xsd:int">16</Value>
</PV> <PV Key="48"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">pkwiu</Value>
</PV> <PV Key="49"
TypeKey="883639814"> <Value
xsi:type="xsd:int">17</Value>
</PV> <PV Key="50"
TypeKey="-664072138"> <Value
xsi:type="xsd:string">rysunek</Value>
</PV> <PV Key="51"
TypeKey="883639814"> <Value
xsi:type="xsd:int">18</Value>
</PV> </P> <R>
<RV Key="59140967" IsRoot="true"
TypeKey="102606522"> <D> <PD
PN="Columns" VK="0" RK="2724161" TK="-1544587235" TCK="0"
/> <PD PN="SortDescriptors" VK="0" RK="30715040"
TK="-880364446" TCK="0" /> <PD
PN="GroupDescriptors" VK="0" RK="4890297" TK="-213719500" TCK="0"
/> <PD PN="FilterDescriptors" VK="0"
RK="60569775" TK="-1313846753" TCK="0" />
</D> </RV> <RV
Key="19330484" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="1" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="2" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="3" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="2724161" IsRoot="false"
TypeKey="-1544587235"> <D>
<PD PN="Columns[]" VK="0" RK="19330484" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="66170694"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="58665336" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="58225979" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="54271769"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="18683873" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="33937134" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="36998751"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="64553311" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="44108894" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="61435734"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="16050694" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="10238520" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="25037822"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="24013807" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="14797678" TK="-2019819835" TCK="0"
/> <PD PN="Columns[]" VK="0" RK="66070243"
TK="-2019819835" TCK="0" /> <PD PN="Columns[]"
VK="0" RK="57761279" TK="-2019819835" TCK="0" />
<PD PN="Columns[]" VK="0" RK="50089467" TK="-2019819835" TCK="0"
/> </D> </RV>
<RV Key="66170694" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="5" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="6" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="7" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="58665336" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="8" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="9" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="10" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="58225979" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="11" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="12" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="13" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="54271769" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="14" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="15" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="16" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="18683873" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="17" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="18" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="19" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="33937134" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="20" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="21" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="22" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="36998751" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="23" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="24" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="25" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="64553311" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="26" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="27" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="28" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="44108894" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="29" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="30" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="31" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="61435734" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="32" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="33" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="34" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="16050694" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="35" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="36" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="37" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="10238520" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="38" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="39" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="38" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="25037822" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="40" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="41" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="40" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="24013807" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="42" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="43" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="42" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="14797678" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="44" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="45" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="44" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="66070243" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="46" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="47" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="46" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="57761279" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="48" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="49" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="48" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
<RV Key="50089467" IsRoot="false" TypeKey="0">
<D> <PD PN="UniqueName" VK="50" RK="0"
TK="-664072138" TCK="0" /> <PD PN="DisplayOrder"
VK="51" RK="0" TK="883639814" TCK="0" /> <PD
PN="Header" VK="50" RK="0" TK="-664072138" TCK="0" />
<PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789"
/> </D> </RV>
</R> </Data></SerializationString>
<ValueTypes>
<string>Telerik.Windows.Controls.RadGridView,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7</string>
<string>System.String, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string>
<string>System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string>
<string>Telerik.Windows.Controls.GridViewLength,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7</string>
<string>Telerik.Windows.Controls.GridView.GridViewLengthConverter,
Telerik.Windows.Controls.GridView, Version=2013.2.724.40,
Culture=neutral, PublicKeyToken=5803cfa389c90ce7</string>
<string>polcom.Additions.ColumnProxy, VisionPOS,
Version=2013.9.18.1, Culture=neutral,
PublicKeyToken=null</string>
<string>System.Collections.Generic.List`1[[polcom.Additions.ColumnProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string>
<string>System.Collections.Generic.List`1[[polcom.Additions.SortDescriptorProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string>
<string>System.Collections.Generic.List`1[[polcom.Additions.GroupDescriptorProxy,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string>
<string>System.Collections.Generic.List`1[[polcom.Additions.FilterSetting,
VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null]],
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089</string> </ValueTypes>
</RawData>