This is a migrated thread and some comments may be shown as answers.

Source type must be an enumerable type

15 Answers 351 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paweł
Top achievements
Rank 1
Paweł asked on 19 Sep 2013, 09:48 AM
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>&lt;?xml version="1.0" encoding="utf-16"?&gt;  &lt;Data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;    &lt;T&gt;      &lt;TI K="102606522" N="Telerik.Windows.Controls.RadGridView, Telerik.Windows.Controls.GridView, Version=2013.2.724.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" /&gt;      &lt;TI K="-664072138" N="System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;      &lt;TI K="883639814" N="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /&gt;      &lt;TI K="-1932319100" N="Telerik.Windows.Controls.GridViewLength, Telerik.Windows.Controls.GridView, Version=2013.2.724.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" /&gt;      &lt;TI K="15099789" N="Telerik.Windows.Controls.GridView.GridViewLengthConverter, Telerik.Windows.Controls.GridView, Version=2013.2.724.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7" /&gt;      &lt;TI K="-2019819835" N="polcom.Additions.ColumnProxy, VisionPOS, Version=2013.9.18.1, Culture=neutral, PublicKeyToken=null" /&gt;      &lt;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" /&gt;      &lt;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" /&gt;      &lt;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" /&gt;      &lt;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" /&gt;    &lt;/T&gt;    &lt;P&gt;      &lt;PV Key="1" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;kod&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="2" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;0&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="3" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Kod&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="4" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Auto&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="5" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;ilosc&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="6" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;2&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="7" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Stan magazynowy&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="8" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;nazwa&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="9" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;3&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="10" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Nazwa POS&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="11" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;nazwa2&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="12" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;4&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="13" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Nazwa paragon&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="14" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;cena&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="15" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;5&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="16" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Cena netto&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="17" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;cena2&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="18" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;1&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="19" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Cena brutto&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="20" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;vat&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="21" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;6&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="22" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;VAT&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="23" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;jMiary&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="24" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;7&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="25" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Jednostka miary&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="26" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;grupa&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="27" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;8&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="28" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Grupa towarowa&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="29" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;czyProdukt&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="30" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;9&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="31" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Produkt?&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="32" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;czyPolprodukt&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="33" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;10&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="34" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Półprodukt?&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="35" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;czySurowiec&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="36" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;11&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="37" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;Surowiec?&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="38" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;categoryID&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="39" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;12&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="40" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;idProduktu&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="41" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;13&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="42" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;nazwa3&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="43" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;14&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="44" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;nazwa4&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="45" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;15&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="46" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;opis&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="47" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;16&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="48" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;pkwiu&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="49" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;17&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="50" TypeKey="-664072138"&gt;        &lt;Value xsi:type="xsd:string"&gt;rysunek&lt;/Value&gt;      &lt;/PV&gt;      &lt;PV Key="51" TypeKey="883639814"&gt;        &lt;Value xsi:type="xsd:int"&gt;18&lt;/Value&gt;      &lt;/PV&gt;    &lt;/P&gt;    &lt;R&gt;      &lt;RV Key="59140967" IsRoot="true" TypeKey="102606522"&gt;        &lt;D&gt;          &lt;PD PN="Columns" VK="0" RK="2724161" TK="-1544587235" TCK="0" /&gt;          &lt;PD PN="SortDescriptors" VK="0" RK="30715040" TK="-880364446" TCK="0" /&gt;          &lt;PD PN="GroupDescriptors" VK="0" RK="4890297" TK="-213719500" TCK="0" /&gt;          &lt;PD PN="FilterDescriptors" VK="0" RK="60569775" TK="-1313846753" TCK="0" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="19330484" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="1" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="2" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="3" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="2724161" IsRoot="false" TypeKey="-1544587235"&gt;        &lt;D&gt;          &lt;PD PN="Columns[]" VK="0" RK="19330484" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="66170694" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="58665336" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="58225979" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="54271769" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="18683873" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="33937134" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="36998751" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="64553311" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="44108894" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="61435734" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="16050694" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="10238520" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="25037822" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="24013807" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="14797678" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="66070243" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="57761279" TK="-2019819835" TCK="0" /&gt;          &lt;PD PN="Columns[]" VK="0" RK="50089467" TK="-2019819835" TCK="0" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="66170694" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="5" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="6" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="7" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="58665336" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="8" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="9" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="10" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="58225979" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="11" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="12" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="13" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="54271769" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="14" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="15" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="16" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="18683873" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="17" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="18" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="19" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="33937134" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="20" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="21" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="22" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="36998751" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="23" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="24" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="25" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="64553311" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="26" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="27" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="28" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="44108894" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="29" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="30" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="31" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="61435734" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="32" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="33" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="34" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="16050694" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="35" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="36" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="37" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="10238520" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="38" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="39" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="38" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="25037822" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="40" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="41" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="40" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="24013807" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="42" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="43" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="42" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="14797678" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="44" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="45" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="44" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="66070243" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="46" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="47" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="46" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="57761279" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="48" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="49" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="48" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;      &lt;RV Key="50089467" IsRoot="false" TypeKey="0"&gt;        &lt;D&gt;          &lt;PD PN="UniqueName" VK="50" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="DisplayOrder" VK="51" RK="0" TK="883639814" TCK="0" /&gt;          &lt;PD PN="Header" VK="50" RK="0" TK="-664072138" TCK="0" /&gt;          &lt;PD PN="Width" VK="4" RK="0" TK="-1932319100" TCK="15099789" /&gt;        &lt;/D&gt;      &lt;/RV&gt;    &lt;/R&gt;  &lt;/Data&gt;</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>

15 Answers, 1 is accepted

Sort by
0
Paweł
Top achievements
Rank 1
answered on 23 Sep 2013, 08:20 AM
Still need help.
0
Dimitrina
Telerik team
answered on 24 Sep 2013, 07:23 AM
Hi,

This error is indeed strange to come up without any interaction from outside (the user or your implementation). Have you defined any filtering? Do you add a FilterDescriptor in your code? What is exact line when this exception occurs? 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 24 Sep 2013, 10:24 AM
Actually I have no idea which line raises that error.
Im getting error in Window.Open even.
Yes, I have FilterDescription implemented like:

 void Window_Loaded(object sender, RoutedEventArgs e)
        {
            LocalizationManager.Manager = new LocalizationManager()
            {
                ResourceManager = GridViewResources.ResourceManager
            };
            productsDataGrid.FilterOperatorsLoading += new EventHandler<Telerik.Windows.Controls.GridView.FilterOperatorsLoadingEventArgs>(productsDataGrid_FilterOperatorsLoading);

            this.productsDataGrid.FieldFilterEditorCreated += new EventHandler<Telerik.Windows.Controls.GridView.EditorCreatedEventArgs>(productsDataGrid_FieldFilterEditorCreated);
            this.productsDataGrid.Filtered += new EventHandler<Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs>(productsDataGrid_Filtered);
            this.productsDataGrid.LayoutUpdated += new EventHandler(productsDataGrid_LayoutUpdated);
            this.productsDataGrid.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(productsDataGrid_MouseDoubleClick);
            this.PreviewKeyDown += new System.Windows.Input.KeyEventHandler(SellWindow_PreviewKeyDown);

            productsDataGrid.ColumnReordered += new EventHandler<GridViewColumnEventArgs>(productsDataGrid_ColumnReordered);
            productsDataGrid.ColumnWidthChanged += new EventHandler<ColumnWidthChangedEventArgs>(productsDataGrid_ColumnWidthChanged);
            
            ProductsBGW();
//read stream from database and aplly it to datagrid
            DataGridLayout.ReadStream(productsDataGrid, "TowaryDG");
        }

        private void ProductsBGW()
        {
//background worker to show 'isbusy' while loading items to datagrid
            BackgroundWorker bw = new BackgroundWorker();
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
            bw.DoWork += (o, ea) =>
            {
                System.Threading.Thread.Sleep(500);
                this.Dispatcher.BeginInvoke(new MyDelegate(Gp), null);
            };
            rbi.IsBusy = true;

            bw.RunWorkerAsync();
        }

        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            rbi.IsBusy = false;

            Telerik.Windows.Controls.GridViewColumn col = productsDataGrid.Columns[0];
//and the columnfilterdescriptor
            Telerik.Windows.Controls.GridView.IColumnFilterDescriptor c = col.ColumnFilterDescriptor;
        }
0
Paweł
Top achievements
Rank 1
answered on 24 Sep 2013, 11:45 AM
I've restored database with this error and checked where it raises and I have to say it completely make no sens:
first time error on  line
            return p;
next time on line
     SellWindow sw = new SellWindow();
                sw.Owner = this.Owner;
                sw.Show();
      ---->          this.Close();

I have custom error messages, and it does happend even there:
       this.ShowDialog(); (MessageBoxWindow with custom message)
0
Dimitrina
Telerik team
answered on 24 Sep 2013, 11:46 AM
Hello,

I have prepared a runnable sample project for you that saves and loads RadGridView settings by using the Persistence Framework. 

When you run the project, you can perform filtering on the grid. Then click the Save button to store those current settings.
Then you can clear the filters and when you click the Load button the settings that you just saved will be restored.

Would you please try modifying my sample to reproduce the issue you report?
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 24 Sep 2013, 11:56 AM
Well, that doesnt really solve my problem. I need to save settings to database and read from it.
When i created saving/restoring I've used examples from telerik demos which should works fine i guess.
And I cannot generate this error, because some of our clients "somehow" make application doesnt work. I've been ask them what did they exactly do, but this isnt helpful.

Example that You send works great. Saving and restoring data. But I need to use database, so it will be able to read and store settings everytime I need it.

I have no idea what to do now. Even try catch doesnt work.
Maybe You can connect to my PC somehow and check application and code and then help?
0
Dimitrina
Telerik team
answered on 24 Sep 2013, 12:40 PM
Hi,

Generally if the exception is caused by the GridView, it would be because you are trying to invoke filter on a string value.
For example if you have a column with DataType = typeof(Int32), then executing this code will break the application:

IColumnFilterDescriptor desc = this.clubsGrid.Columns["IntColumn"].ColumnFilterDescriptor;
desc.FieldFilter.Filter1.Value = "5";
desc.FieldFilter.Filter1.Operator = FilterOperator.Contains;

Would you please check your code and ensure that the loaded FilterDescriptors are correct and the same you saved?
 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 24 Sep 2013, 03:02 PM
Thanks for reply.
I dont have any value set as filter as You said.
Only code related with filtering is:

void productsDataGrid_FilterOperatorsLoading(object sender, Telerik.Windows.Controls.GridView.FilterOperatorsLoadingEventArgs e)
        {
            e.DefaultOperator1 = Telerik.Windows.Data.FilterOperator.Contains;
        }

 void productsDataGrid_FieldFilterEditorCreated(object sender, Telerik.Windows.Controls.GridView.EditorCreatedEventArgs e)
        {
            if (e.Column == this.productsDataGrid.Columns[2])
            {
                this.firstEditor = e.Editor;
            }
        }


        void productsDataGrid_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
        {
            if (productsDataGrid.Items.Count > 0)
            {
                productsDataGrid.SelectedItem = productsDataGrid.Items[0];
                productsDataGrid.Focus();
                if (firstEditor != null)
                {
                    TextBox tb = this.firstEditor.ChildrenOfType<TextBox>().Single();
                    tb.GotFocus -= this.TbGotFocus;
                }
            }
        }


But even when I comment that code still doesnt work.
0
Dimitrina
Telerik team
answered on 25 Sep 2013, 07:36 AM
Hi,

Then, the problem should be related to something else, not the GridView. Unfortunately we cannot guess much when we cannot reproduce such a problem.

Would you please try to isolate the issue excluding the additional implementation you have step by step?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 25 Sep 2013, 08:30 AM
Ok, there is my code :
http://pastebin.com/ii9Epg0d
I decided to put it into pastebin, becouse of c# highlights.

Regards and thanks in advance.

I forgot about one last thing:
there is backgroundworker which is set isbusy = true while products loaded.
in completed method there is :

        void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            rbi.IsBusy = false;
            Telerik.Windows.Controls.GridViewColumn col = productsDataGrid.Columns[0];
            Telerik.Windows.Controls.GridView.IColumnFilterDescriptor c = col.ColumnFilterDescriptor;
        }
0
Dimitrina
Telerik team
answered on 25 Sep 2013, 08:57 AM
Hi,

Thank you for sharing your code.
I have reviewed it and I cannot spot a possible problem with RadGridView. 

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 25 Sep 2013, 09:00 AM
Hello,
so is there any possible solution?

Regars.
0
Rossen Hristov
Telerik team
answered on 25 Sep 2013, 09:10 AM
Hello,

This piece of code does absolutely nothing:

Telerik.Windows.Controls.GridViewColumn col = productsDataGrid.Columns[0];
Telerik.Windows.Controls.GridView.IColumnFilterDescriptor c = col.ColumnFilterDescriptor;

You declare a variable of type IColumnFilterDescriptor and then assign the col.ColumnFilterDescriptor instance to this variable. So you now have an IColumnFilterDescriptor in the variable c. Then you do absolutely nothing with the variable c. It will be garbage collected one line down when you exit the scope.

We can't really see the idea behind this piece of code which does absolutely nothing.

My colleague has prepared a sample project especially for you to demonstrate how settings are saved and loaded.l

Saving and restoring filter descriptors is explained in great details in this help topic. Make sure you follow it correctly. From the code you pasted this does not seem to be the case. 

We can't really understand what is going on unless we can debug something locally.

Once you serialize your proxies to your storage, use your debugger and make sure that when you deserialize them from your storage -- they contain the same information as when you were serializing them. Make sure is that what you save is the same as what you load, i.e. it is not corrupted by your storage somehow. Only you can check this.

Without being able to actually run and debug a project locally, I am afraid that we cannot be of any further assistance. If you can modify my colleague's project or prepare a runnable one that we can debug, we will be happy to see what is going on. But unless we can do that it is like shooting in the dark.

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Paweł
Top achievements
Rank 1
answered on 25 Sep 2013, 09:24 AM
Ok, thanks for reply. I will create simple application and send app + database so You can check what's going on.
But first - I have no idea why, but it's seems to work now (actually i havn't really changed anytghing).
And as Didie said in previous post there was value in TextBox inside column header with code (code as varchar in database and in column), which was loaded from database and applied to gridview.
I'm not sure if it help, but is there any way to do loop foreach columnHeader in gridview and clear value and then apply source to load gridview column configuration?

Regads
0
Rossen Hristov
Telerik team
answered on 25 Sep 2013, 09:36 AM
Hello,

I will try to explain once again.

As long as RadGridView is concerned, it has to provide information about its filtering, which it does, and you then save this information to a collection of proxies. This is described in the article I mentioned. Then when you deserialize those proxies from *somewhere*, the code in the article shows how to restore RadGridView's filtering settings based on those proxies. RadGridView only cares about this parts.

What happens in the middle in your database is not directly concerning RadGridView.

RadGridView -> proxies -> storage(your db) -> proxies -> RadGridView.

RadGridView does not care whether this information was stored in a string, an XML file or a database of some sort.

All it ever cares about is this:

public static IEnumerable<FilterSetting> SaveColumnFilters(Telerik.Windows.Controls.GridView.GridViewDataControl grid)
        {
            IList<FilterSetting> settings = new List<FilterSetting>();
 
            foreach (Telerik.Windows.Data.IFilterDescriptor filter in grid.FilterDescriptors)
            {
                Telerik.Windows.Controls.GridView.IColumnFilterDescriptor columnFilter = filter as Telerik.Windows.Controls.GridView.IColumnFilterDescriptor;
                if (columnFilter != null)
                {
                    FilterSetting setting = new FilterSetting();
 
                    setting.ColumnUniqueName = columnFilter.Column.UniqueName;
 
                    setting.SelectedDistinctValues.AddRange(columnFilter.DistinctFilter.DistinctValues);
 
                    if (columnFilter.FieldFilter.Filter1.IsActive)
                    {
                        setting.Filter1 = new FilterDescriptorProxy();
                        setting.Filter1.Operator = columnFilter.FieldFilter.Filter1.Operator;
                        setting.Filter1.Value = columnFilter.FieldFilter.Filter1.Value;
                        setting.Filter1.IsCaseSensitive = columnFilter.FieldFilter.Filter1.IsCaseSensitive;
                    }
 
                    setting.FieldFilterLogicalOperator = columnFilter.FieldFilter.LogicalOperator;
 
                    if (columnFilter.FieldFilter.Filter2.IsActive)
                    {
                        setting.Filter2 = new FilterDescriptorProxy();
                        setting.Filter2.Operator = columnFilter.FieldFilter.Filter2.Operator;
                        setting.Filter2.Value = columnFilter.FieldFilter.Filter2.Value;
                        setting.Filter2.IsCaseSensitive = columnFilter.FieldFilter.Filter2.IsCaseSensitive;
                    }
 
                    settings.Add(setting);
                }
            }
 
            return settings;
        }
 
        public static void LoadColumnFilters(Telerik.Windows.Controls.GridView.GridViewDataControl grid
            , IEnumerable<FilterSetting> savedSettings)
        {
            grid.FilterDescriptors.SuspendNotifications();
 
            foreach (FilterSetting setting in savedSettings)
            {
                Telerik.Windows.Controls.GridViewColumn column = grid.Columns[setting.ColumnUniqueName];
 
                Telerik.Windows.Controls.GridView.IColumnFilterDescriptor columnFilter = column.ColumnFilterDescriptor;
 
                foreach (object distinctValue in setting.SelectedDistinctValues)
                {
                    columnFilter.DistinctFilter.AddDistinctValue(distinctValue);
                }
 
                if (setting.Filter1 != null)
                {
                    columnFilter.FieldFilter.Filter1.Operator = setting.Filter1.Operator;
                    columnFilter.FieldFilter.Filter1.Value = setting.Filter1.Value;
                    columnFilter.FieldFilter.Filter1.IsCaseSensitive = setting.Filter1.IsCaseSensitive;
                }
 
                columnFilter.FieldFilter.LogicalOperator = setting.FieldFilterLogicalOperator;
 
                if (setting.Filter2 != null)
                {
                    columnFilter.FieldFilter.Filter2.Operator = setting.Filter2.Operator;
                    columnFilter.FieldFilter.Filter2.Value = setting.Filter2.Value;
                    columnFilter.FieldFilter.Filter2.IsCaseSensitive = setting.Filter2.IsCaseSensitive;
                }
            }
 
            grid.FilterDescriptors.ResumeNotifications();
        }

What you do with the proxies after you save them and where they come from when you load them does not concern RadGridView. So we don't really need your database -- it is not directly related to RadControls. It could easily be a MemoryStream or an XML file instead of your particular database and all would be the same.

You only have to make sure that what you save in the first method is the same as what you load in the second method. What happens to those things in between is of no concern for RadGridView.

Does this makes sense?

Regards,
Rossen Hristov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Paweł
Top achievements
Rank 1
Answers by
Paweł
Top achievements
Rank 1
Dimitrina
Telerik team
Rossen Hristov
Telerik team
Share this question
or