RadPivotGrid RadPersistenceManager XML

3 posts, 0 answers
  1. newp
    newp avatar
    15 posts
    Member since:
    Jan 2017

    Posted 09 Jan Link to this post

    Hi,

    I have added  RadPivotGrid to my vb.net page and RadPersistenceManager . I managed to save and load the user current state with the following:

     RadPersistenceManager1.StorageProviderKey = fileId
            RadPersistenceManager1.SaveState()

     

    However, I need to get the XML and save the XML in the db and then load the xml when user clicks the load button.

    How do I get the XML for the current state?

     

    Thanks

  2. Lance | Tech Support Engineer, Sr.
    Admin
    Lance | Tech Support Engineer, Sr. avatar
    316 posts

    Posted 10 Jan Link to this post

    Hi Newp,

    I've attached a small demo that saves a PivotGrid using the PersistenceManager and then loads the persisted XML into a TextBlock.

    Here are the steps to take to use the demo:

    1-  Run the app and you'll see a RadPivotGrid populated with sample data
    2 - Click the "Save PivotGrid and show XML" button

    You'll see the XML, with escaped characters, appear in the OutputTextBlock.


    Here's a screenshot of the result:




    Here's the relevant code:

    private async void SaveButton_OnClick(object sender, RoutedEventArgs e)
    {
                Stream stream = null;
     
                PersistenceManager manager = new PersistenceManager();
                stream = manager.Save(radPivotGrid1);
     
                // Make sure you rewind the stream before trying to do anything with it
                stream.Position = 0;
     
                // You can use a StreamReader to read out the XML
                using (var sr = new StreamReader(stream))
                {
                    OutputTextBlock.Text = await sr.ReadToEndAsync();
                }
     
                // See here on how to load
    }

    I also recommend taking a look at this page in the documentation to see how to use the Load method. Let us know if you have any further questions or concerns, thank you for choosing Telerik by Progress.

    Regards,
    Lance | Tech Support Engineer, Sr.
    Telerik by Progress
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. newp
    newp avatar
    15 posts
    Member since:
    Jan 2017

    Posted 11 Jan in reply to Lance | Tech Support Engineer, Sr. Link to this post

    Thanks for the reply. However, I have noticed now that I posted the question in the wrong forum. I am using asp.net (webform).

    I will repost my question.

Back to Top