Not getting persistance in usercontrol to work

5 posts, 0 answers
  1. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 10 Sep 2014 Link to this post

    I have a usercontrol, categoryTree, for which I want to save it's state (namely whether checkboxes in a RadTreeView are checked) across sessions. So I have added this to the main page:

    <telerik:RadPersistenceManager ID="RadPersistenceManager1" runat="server">
        </telerik:RadPersistenceManager>

    And this to categoryTree.aspx:

    ​<telerik:RadPersistenceManagerProxy ID="RadPersistenceManagerProxy1" runat="server">
        <PersistenceSettings>
            <telerik:PersistenceSetting ControlID="RadTreeView1" />
        </PersistenceSettings>
    </telerik:RadPersistenceManagerProxy>

    And this to the codebehind:

    private RadPersistenceManager _persistenceManager;

    protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
                _persistenceManager = RadPersistenceManager.GetCurrent(Page);
                if (!IsPostBack)
                    _persistenceManager.LoadState();
            }


    (and in the event for checked nodes):

    _persistenceManager.SaveState();

    But after I restart the page, the previous state does not get loaded. What am I missing?
  2. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 10 Sep 2014 in reply to C Link to this post

    I have also tried doing the save and load in the main page's Page_Load and Page_PreRender. But nothing happens.

    What else needs to happen before the data persists?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter Filipov
    Admin
    Peter Filipov avatar
    1028 posts

    Posted 15 Sep 2014 Link to this post

    Hi,

    Please review the attached project. It implements the desired functionality. Keep in mind that for the first start of your application there should be a file (TelerikAspNetRadControlsPersistedState) in the App_data folder.

    Regards,
    Peter Filipov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 15 Sep 2014 in reply to Peter Filipov Link to this post

    I actually managed to save the state by myself. However, I am now struggling with the following:

    I save the state of a RadListBox, which in turn filters events for a RadScheduler. However, I haven't been able to make the scheduler use the state of the listbox before it's first load.

    That is, the first time the page loads, the filter settings are correct (checkboxes), but the data in the scheduler does not reflect this.
  6. C
    C avatar
    43 posts
    Member since:
    Jul 2013

    Posted 15 Sep 2014 Link to this post

    Nevermind, I think I've solved it.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017