9 Answers, 1 is accepted
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.
For your convenience I have attached a sample WebSite utilizing both scenarios, please review it and let me know if you need additional information.
the Telerik team
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.
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,
the Telerik team
thank you for your explanation.
I will use try catch block.
Have a nice day.
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.
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,
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:
I hope this will be helpful.
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!