More examples ?

10 posts, 2 answers
  1. Vasssek
    Vasssek avatar
    185 posts
    Member since:
    Aug 2010

    Posted 12 Mar 2013 Link to this post

    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
  2. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 14 Mar 2013 Link to this post

    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.
  3. Vasssek
    Vasssek avatar
    185 posts
    Member since:
    Aug 2010

    Posted 01 Apr 2013 Link to this post

    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
     
  4. Answer
    Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 03 Apr 2013 Link to this post

    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.
  5. Vasssek
    Vasssek avatar
    185 posts
    Member since:
    Aug 2010

    Posted 03 Apr 2013 Link to this post

    Hello,

    thank you for your explanation.

    I will use try catch block.

    Have a nice day.

    Vasssek
  6. John
    John avatar
    43 posts
    Member since:
    Aug 2014

    Posted 23 Jul 2015 in reply to Dobromir Link to this post

    Looking at the example code, I don't see where you uniquely identify the Session State on a per User basis.  Please advise. 
  7. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 28 Jul 2015 Link to this post

    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
  8. Alex
    Alex avatar
    2 posts
    Member since:
    Aug 2016

    Posted 22 May in reply to Dobromir Link to this post

    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.

     

     

  9. Attila Antal
    Admin
    Attila Antal avatar
    426 posts

    Posted 27 May Link to this post

    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.
  10. Alex
    Alex avatar
    2 posts
    Member since:
    Aug 2016

    Posted 27 May in reply to Attila Antal Link to this post

    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!

     

Back to Top