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

More examples ?

9 Answers 126 Views
Persistence Framework
This is a migrated thread and some comments may be shown as answers.
Vasssek
Top achievements
Rank 1
Vasssek asked on 12 Mar 2013, 07:10 AM
Hello,

could you please provide more examples, how to save or persist control's state ? Some simple examples for ComboBox, Grid and PanelBar ? I use C# in combination with master page...

Thank you.

Best regards

Vasssek

9 Answers, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 14 Mar 2013, 02:04 PM
Hi,

In scenarios with MasterPage / UserControls the recommended approach is to register RadPersistenceManager in the MasterPage / MainPage and RadPersistenceManagerProxy in the ContentPage / UserControl and register the controls that should be persisted to the corresponding control.

In the following help article, you can find currently supported RadControls and the Properties that will be persisted.
http://www.telerik.com/help/aspnet-ajax/persistence-framework-supported-controls.html

For your convenience I have attached a sample WebSite utilizing both scenarios, please review it and let me know if you need additional information.

Regards,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 01 Apr 2013, 08:17 PM
Hello,

I would like to thank you for your explanation and an example as well. Now, I'm able to save telerik control's state :)).
 
This Persistence Framework is pefrect !!!

But I have one small issue, yet. When I call persistenceMngr.LoadState() and it has not been saved before, the error appeared: Unable to read storage content. Could not find file 'C:\inetpub\ASP_Kysuce\Vyroba_test\App_Data\myKey'. Of course, I can make it safety with try catch block, but I want to know, how can I detect whether there was saved something to persistance framework or not without usage of try catch.

Thank you for your advice.

Best regards

Vasssek
 
0
Accepted
Dobromir
Telerik team
answered on 03 Apr 2013, 03:43 PM
Hi Vasssek,

Using Try-Catch is the recommended approach check if there is a previously saved state that can be loaded. The Persistence Framework does not provide any built-in tools to check if there are available states.

Nevertheless, if you are using the AppDataStorageProvider (the default one) you can check if there is a file with the same name as the value of StorageProviderKey property located in the App_Data folder, but again using Try-Catch is the correct way to handle this case.

All the best,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 03 Apr 2013, 07:49 PM
Hello,

thank you for your explanation.

I will use try catch block.

Have a nice day.

Vasssek
0
John
Top achievements
Rank 1
answered on 23 Jul 2015, 10:53 PM
Looking at the example code, I don't see where you uniquely identify the Session State on a per User basis.  Please advise. 
0
Konstantin Dikov
Telerik team
answered on 28 Jul 2015, 01:27 PM
Hi John,

It is up to the developer to find a suitable logic for changing the StorageProviderKey per user, so it could be unique for each user.

Hope this helps.


Regards,
Konstantin Dikov
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 22 May 2019, 07:07 PM

Hello,

Quick question... Based on the example attached, it looks like all Save/Load persistence functionality is implemented within the Master page. Isn't it a little bit awkward to handle child page state from within the Master page?

 

Thanks in advance,

Alex.

 

 

0
Attila Antal
Telerik team
answered on 27 May 2019, 12:37 PM
Hi Alex,

Could you help me get a better understanding on your point, are you experiencing some issues?

The control was designed in a way, if Master / Content pages are used, then it would allow users to combine the controls on the MasterPage with the ones on the content page without having duplication. Similar to RadAjaxManager and RadAjaxManagerProxy, you can have RadPersistenceManager on the master page and a RadPersistenceManagerProxy on content pages or Web UserControls. 

Controls on the Content page are added to the RadPersistenceManagerProxy, while Saving/Restoring the state of the controls are done through the Manager itself. 

Accessing the Master Page's Manager from a Content page can be done as follows:

protected void RadButton1_Click(object sender, EventArgs e)
{
    RadPersistenceManager persistenceManager = RadPersistenceManager.GetCurrent(Page);
 
    persistenceManager.SaveState();
    persistenceManager.LoadState();
}

VB

Protected Sub RadButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim persistenceManager As RadPersistenceManager = RadPersistenceManager.GetCurrent(Page)
    persistenceManager.SaveState()
    persistenceManager.LoadState()
End Sub

I hope this will be helpful.

Kind regards,
Attila Antal
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Alex
Top achievements
Rank 1
answered on 27 May 2019, 08:30 PM

Hi Attila,

Thanks for taking the time to provide additional examples/info.

I guess one of the previous examples attached to this thread had the Save/Load buttons on the master page, which was bit confusing to me. 

It's all good now, thanks again!

 

Tags
Persistence Framework
Asked by
Vasssek
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Vasssek
Top achievements
Rank 1
John
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Alex
Top achievements
Rank 1
Attila Antal
Telerik team
Share this question
or