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

RadPivotGrid RadPersistenceManager XML

2 Answers 83 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
newp
Top achievements
Rank 1
newp asked on 09 Jan 2017, 05:38 PM

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 Answers, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 10 Jan 2017, 07:58 PM
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.
0
newp
Top achievements
Rank 1
answered on 11 Jan 2017, 07:08 AM

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.

Tags
PivotGrid
Asked by
newp
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
newp
Top achievements
Rank 1
Share this question
or