Migration of data

2 posts, 0 answers
  1. Ken
    Ken avatar
    104 posts
    Member since:
    Aug 2010

    Posted 07 Oct 2011 Link to this post


    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)?

  2. Alex Fidanov
    Alex Fidanov avatar
    636 posts

    Posted 11 Oct 2011 Link to this post

    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 >>

  3. DevCraft R3 2016 release webinar banner
Back to Top