This is a migrated thread and some comments may be shown as answers.

storing the state of docks - client side

1 Answer 41 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Kishan Gandikota
Top achievements
Rank 1
Kishan Gandikota asked on 14 Dec 2011, 09:45 AM
Hi,

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());
            serializer.RegisterConverters(converters);
 
            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?
Regards,
Kishan G K

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 16 Dec 2011, 01:59 PM
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.

Greetings,
Slav
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
Tags
Dock
Asked by
Kishan Gandikota
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or