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

Migration of data

1 Answer 73 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Ken
Top achievements
Rank 1
Ken asked on 07 Oct 2011, 02:04 PM
Hi,

In playing with the persistence framework I've found that if I follow the example with saving a Grids sort/filter status, if one of the Grid columns is later removed, then the call to IsolatedStorageProvider.LoadFromStorage() throws. What's worse, a try/catch doesn't help, as it seems to be setting something wrongly on the GridView, which then later throws itself and fails to render.

What's the suggested solution for this case (which I can imagine as a common one, when you ship v1 of your app with some grid columns, then later v2 with some changed columns, while the user still has the persisted UI state for v1 in isolated storage)?

Thanks

1 Answer, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 11 Oct 2011, 05:48 PM
Hello Adrian,

The exception is probably coming from the custom property provider for the RadGridView. I noticed, that a null check is missing from the provider in our online demos and could be the cause of the exception. This check is required in the RestoreValue method in both the SortDescriptors and GroupDescriptors cases: The safe code should look like this :

GridViewColumn column = this.GetColumnInstance(gridView, proxy.ColumnUniqueName);
 if (column != null)
 {
     gridView.GroupDescriptors.Add(new ColumnGroupDescriptor() { Column = column, SortDirection = proxy.SortDirection });
 }
Please note, in order to restore the settings of the GridView control correctly, you need to ensure that its columns are already loaded. This is because, the Group/Sort/Filter descriptors require a hard reference to the corresponding column.

Best wishes,
Alex Fidanov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
PersistenceFramework
Asked by
Ken
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Share this question
or