I've used RadPersistenceManager and follow the following guide :
Everything work fine in my machine and development server, but on production the below exception occurred, even the cookie is created on the client machine:
Title: xxxx.aspx, xxxxx Method Name:
Unable to read storage content. Could not find file
key) at Telerik.Web.UI.RadPersistenceManager.LoadState() at GraphicalUserInterface.JobBasket.LoadGridJobBasket()
The cookie is created on the client machine
9 Answers, 1 is accepted
This means that you have not set the cookie storage provider in the code-behind. Please double check that.
The different between the demo and my example that I need to load the persistence configurations on page load instead of load button. so it seems some times the CookieStorageProvider not initiated in Page_Init, so I added it in page_load instead.
Kindly advice if there is no effect in this solution.
Moving the loading logic as described should not cause an inconsistency in the behavior. Considering the aforementioned I would kindly like to ask you to share with us the markup and code-behind of the page so we could research what may be causing this issue.
What Telerik version are you using? Apparently, 2015Q2 is buggy with respect to the Persistent Framework. I have two VS Solutions, one running 2014Q2, and one running 2015Q2. Using copies of the same Content Page and associated code-behind, Persistence works, for me, in 2014Q2; but, not 2015Q2.
Could you please elaborate more on what problems are you experiencing? Maybe we can provide a solution for them.
To elaborate,I was specifically getting an error upon Build of my web app: "The name 'RadPersistenceManager1' does not exist in the current context". The app doesn't complain until I do a Build. Then, I get the blue squiggly line under RadPersistenceManager1 in code-behind. In another thread, I found that if I 'View In Browser' the aspx page, I can circumvent the pre-build process. It then gives me a runtime error: Unable to read storage content. Could not find file 'c:\...\visual studio 2013\Projects\...\App_Data\TelerikAspNetRadControlsPersistedState'.
However, since my last post, I came to realize that it wasn't necessarily a version-difference problem. RadPersistenceManager worked when I created a new VS Solution, regardless of the Telerik version. I tried both Q3 2014 and Q2 2015 in the existing Solution and the new test Solution. I'm not sure what the Persistence Framework did not like about current VS Solution; but, my work-around for now, is to create a fresh VS Solution then add (import) my existing code/projects.
In most of the cases problems like the described occur when the CodeBehind is mistaken with CodeFile in the page directive. CodeFile is normally used in Web Sites whereas the CodeBehind in Web Applications(which required a build).
Since you mentioned that you hare resolved the matter I suggest moving the logic inside the new solution which will not throw errors.
The Project was originally created as a website, which was recommended early-on by one of the Telerik Support people. Where, they said that it would be easier to deal with than a web app. As, such my Page Directives use CodeFile. Since my last post, I've created a new Solution and moved everything over; it seems to be working fine now, with no runtime errors and no blue squiggly lines.
I do have another RadPersistenceManager issue, as it relates to Page_Load/Unload; but, not sure which forum thread to post. It was recommended to me, on Stack Overflow, to use Page_Load to assign the StorageProviderKey and execute LoadState(), then use Page_Unload to execute SaveState(). I have a RadTabStrip, with (3) tabs, each with a RadGrid. My PersistenceSettings identify each RadGrid. If I simply go into the first tab, make a filter or sort change to the grid, close the page, it saves the filter and sort settings, as it's supposed to. So far, it works great. Where things go bad and where it gets complicated is when I click to another tab, or select another Sort column, or filter on a second column. My Page feels that it needs to Page_Load on each of those; therefore, reloading the saved ViewState. Besides resetting my filter & sort expressions, it's also a performance problem. I shouldn't have to go back to the server and pull data again. It should handle filters & sorts on the client -side...I would think.
So, two questions ...
1) How can I reduce the number of client/server round-trips on a page with multiple tabs & grids?
2) What is Telerik's recommended way of when/where/how to execute LoadState & SaveState?
Thanks in advance.
Regarding to the queries.
- Generally if you do not set the RenderSelectedPageOnly property of the multi page to false the controls inside the multi-pages will be initialized and by switching the tabs you should not initiate a postback. As for reducing the grid postbacks you can modify the control logic so that client-side binding is used. That way complex operations such as filtering, sorting and etc will not cause a round-trip to the server.
- There is no guideline that one can follow. One can save load the settings according to its requirements. As long as the control can recreate correctly when loading the settings all should be working fine. The general solution indeed would be the use the page load/unload events which are fired when the page initialized(early enough to load the settings) and when the controls are fully initialized(to save the settings).