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

GridView 'is not marked as serializable' problem.

5 Answers 124 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jokerwolf
Top achievements
Rank 1
Jokerwolf asked on 08 Jul 2010, 07:58 AM
Hello,
I'm using RadControls for WPF Q1 2010 SP2.
I'm trying to save data from the Gridview with BinaryFormatter. My custom class is marked as serializable and saving List<MyClass> is OK, but when I'm trying to save MyGridView.Items the following error occures:

Type 'Telerik.Windows.Data.WeakEvent+WeakListener`1[[System.ComponentModel.
PropertyChangedEventArgs, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'
in Assembly 'Telerik.Windows.Data, Version=2010.1.603.35, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'
is not marked as serializable.

Maybe I'm doing something wrong, so I need help, please.

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Jul 2010, 08:30 AM
Hi Jokerwolf,

 Why not try to get new list from the grid Items and save this list instead? Here is an example:

var list = RadGridView1.Items.OfType<MyClass>().ToList();

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jokerwolf
Top achievements
Rank 1
answered on 08 Jul 2010, 08:47 AM
No change at all :0) Well, maybe there is another way to save and load data from the GridView?
0
Milan
Telerik team
answered on 13 Jul 2010, 09:18 AM
Hi Jokerwolf,

Before you invoke the BinaryFormatter please try to clear the ItemsSource of the grid and it should work.

this.myGridView.ItemsSource = null;
// invoke formatter


All the best,
Milan
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jokerwolf
Top achievements
Rank 1
answered on 13 Jul 2010, 10:32 AM
That doesn't work, too.
Maybe it is important: We're using WCF service to get the data for gridview.
0
Jokerwolf
Top achievements
Rank 1
answered on 13 Jul 2010, 11:36 AM
The problem is solved now. We're using XmlSerializer to save and load data.
Tags
GridView
Asked by
Jokerwolf
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jokerwolf
Top achievements
Rank 1
Milan
Telerik team
Share this question
or