RadPersistenceManager and RadTreeView with ExpandMode.ServerSideCallBack

3 posts, 1 answers
  1. archimede
    archimede avatar
    108 posts
    Member since:
    Jul 2006

    Posted 25 Aug Link to this post

    Hi

    I have a inherited class of RadTreeView with TreeNodeExpandMode set on ServerSideCallBack.

    I will save the RadTreeView's expanded nodes using RadPersistenceManager. 

    01.<telerik:RadPersistenceManager ID="RadPersistenceManager" runat="server">
    02.</telerik:RadPersistenceManager>
    03. 
    04.<mwc:RadTreeView ID="rtvStruttura" runat="server" BorderColor="Gray" Skin="WebBlue"
    05.                OnClientNodeExpanded="metTreeClientNodeExpanded" OnClientNodeCollapsed="metTreeClientNodeExpanded" OnNodeExpand="metPopulateNodeOnDemandWrapper"
    06.                OnClientContextMenuShowing="rtvContextMenu_OnClientContextMenuShowing" OnClientContextMenuItemClicked="rtvContextMenu_OnClientContextMenuItemClicking">
    07.                <ContextMenus>
    08.                    <mwc:RadTreeViewContextMenu ID="rtvContextMenu" runat="server" ExpandAnimation-Type="None" CollapseAnimation-Type="None">
    09.                        <Items>
    10.                            <mwc:RadMenuItem Value="1" LabelResources="VaiAllaScheda_si" />
    11.                            <mwc:RadMenuItem IsSeparator="true" />
    12.                            <mwc:RadMenuItem Value="2" LabelResources="TitoloNuovaRichiestaIntervento_si" />
    13.                        </Items>
    14.                    </mwc:RadTreeViewContextMenu>
    15.                </ContextMenus>
    16.            </mwc:RadTreeView>

     

    I set ControlID on RadPersistenceManager at server side

    RadPersistenceManager.StorageProvider = new CookieStorageProvider(GetPersistenceManagerKey());
    PersistenceSetting vPersistenceTree = new PersistenceSetting();
    vPersistenceTree.ControlInstance = (System.Web.UI.Control)((Telerik.Web.UI.RadTreeView)FindControl("rtvStruttura"));
     vPersistenceTree.ControlType = typeof(Telerik.Web.UI.RadTreeView);
    RadPersistenceManager.PersistenceSettings.Add(vPersistenceTree);

    CookieStorageProvider is the class of this example: https://demos.telerik.com/aspnet-ajax/persistence-framework/examples/custom-storage-provider/defaultcs.aspx

    I use two button to save/load state

    protected void btnSaveState_Click(object sender, EventArgs e)
       {
               RadPersistenceManager.SaveState();
       }
     
       protected void btnLoadState_Click(object sender, EventArgs e)
       {
               string key = GetPersistenceManagerKey();
               if (Request.Cookies[key] != null)
               {
                   RadPersistenceManager.LoadState();
               }
       }

     

    When I save a state I receive only this code

    <?xml version="1.0"?>
    <ArrayOfRadControlState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <RadControlState>
        <ControlSettings />
        <UniqueId>Telerik.Web.UI_PersistanceManager_CustomSettings</UniqueId>
      </RadControlState>
    </ArrayOfRadControlState>

     

    Where am I doing wrong? Why am I not getting the status of the RadTreeView?

    I use Telerik Ajax Q2 2012.

    Thanks

  2. archimede
    archimede avatar
    108 posts
    Member since:
    Jul 2006

    Posted 03 Sep Link to this post

    Any Ideas?
  3. Answer
    Vessy
    Admin
    Vessy avatar
    2278 posts

    Posted 08 Sep Link to this post

    Hi Francesco,

    The support for RadTreeView persistance is officially added in August 2013 so you will need to upgrade at least to 2013 Q3 in order to have it.

    Once you upgrade to this version, you can also consider is StoreCustom setting functuionality of the framework, allowing you to save the settings of custom controls:

    https://docs.telerik.com/devtools/aspnet-ajax/controls/persistenceframework/functionality/store-custom-settings\

    Regards,
    Vessy
    Progress Telerik

    Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive , special prizes and more, for FREE?! Register now for DevReach 2.0(20).

Back to Top