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

Save DockLayout on Page Unload

1 Answer 10 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Christophe asked on 07 May 2013, 05:43 AM

I have coded a page with a RadTabStrip + RadMultiPages embedded in a RadDockLayout (see code sample below), on which I can dynamically add new tabs. Each tab embeds a RadDockZone and when I press my AddDock button it creates a new dock in the currently selected RadDockZone.

<asp:UpdatePanel ID="UPLineManager" runat="server" UpdateMode="Conditional">
        <telerik:RadButton ID="rbtAddLine" runat="server" OnClick="rbtAddLine_Clicked" Text="New">
        <telerik:RadButton ID="ButtonAddStop" runat="server" OnClick="ButtonAddStop_Click"
            Text="Add Stop" />
            <telerik:RadDockLayout ID="RdlLineBuilder" runat="server" OnSaveDockLayout="RdlLineBuilder_SaveDockLayout"
                <telerik:RadTabStrip ID="rtsLines" runat="server" CssClass="rtsLines" MultiPageID="mpLines"
                <telerik:RadMultiPage ID="mpLines" runat="server" CssClass="multiPageViewContent"
                    Height="400" OnPageViewCreated="mpLines_PageViewCreated">
                <telerik:RadAjaxLoadingPanel ID="ralpLines" runat="server">

Everything works like a charm here. Although I'm not 100% happy with this.

I can have up to 12 tabs opened at the same time and each of those tabs can host up to 60 docks. ie the Page itself could host up to 624 docks, which is quite heavy I must say.
Therefore I'm trying to get everything done on the client side and avoid pointless postbacks when I can. I disabled the AutoPostBack properties from my docks hence, only the client event OnClientDockPositionChanged is trigger (no postback on DockPositionChanged). This avoids to rebuild the whole bunch of possibly 624 docks every time I move one.
The issue here is obviously if I refresh the page I lose all of my dock states.

My question is as follow: Is there a way to save the DockLayout before the page is being reloaded while AutoPostBack on docks is set to false ? Something like RadDockLayout.RefreshDockLayout() from code behind would be awesome :)
Should I send a big chunk of JSON data (the dockstates) to my server prior to reloading the page ? If so, what would be the best way to do such thing ?



1 Answer, 1 is accepted

Sort by
Telerik team
answered on 09 May 2013, 04:16 PM
Hello Chris,

There is a custom approach for saving the RadDock state on the client that could be useful in your case. It includes a function GetSaveState that gets the dock state from its client-side object and serializes it. After the state is retrieved, all you need to do is perform an asynchronous request to the server in order to store the dock state, for example by making a callback via the RadXmlHttpPanel. You can find attached a sample project that demonstrates the described approach.

Kind regards,
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.
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question