storing the state of docks - client side

2 posts, 0 answers
  1. Kishan Gandikota
    Kishan Gandikota avatar
    44 posts
    Member since:
    Sep 2009

    Posted 14 Dec 2011 Link to this post


    I have bunch of raddock zones in my page and the user of our page often changes the size/position of docks to their liking. So to achieve that we have used this piece of code:
    var dockStates = dockLayout.GetRegisteredDocksState();
                var serializer = new JavaScriptSerializer();
                var converters = new List<JavaScriptConverter>();
                converters.Add(new UnitConverter());
                string stateString = dockStates.Select(state => serializer.Serialize(state)).Aggregate(String.Empty, (current, ser) => current + "|" + ser);

    This code works perfectly fine. Now our requirement is: the moment docks are repositioned/resized on the page, the preferences should be saved. I tried adding autopostback - true for all the individual rad-docks and also OnDockPositionChanged event and added the above code. But the code dockLayout.GetRegisteredDocksState() is not giving up-to-date change. 

    Can you please assist on how to achieve this?
    Kishan G K
  2. Slav
    Slav avatar
    1359 posts

    Posted 16 Dec 2011 Link to this post

    Hello Kishan,

    Please check the help articles on the events SaveDockLayout and LoadDockLayout of the RadDockLayout control, used for saving and persisting the layout of the dock controls on the page. I would suggest utilizing these events in order to save and load the RadDock's state, if you haven't done so already. This way you can implement your saving state logic in SaveDockLayout, which will be fired on every page load, so that the state is saved every time a RadDock initiates postback(its property AutoPostBack is set to true). Similar approach is implemented in the online demo My Portal.

    I hope the provided information will help you resolve your problem. If you are still experiencing difficulties please send us a simple, runnable page that isolates your case so that we can inspect it locally and pinpoint the cause.

    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
Back to Top